Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300728

Assert the current path on Views AJAX requests is not set with two leading slashes

$
0
0

In the AJAX request, Views passes the current path (retrieved in views_views_pre_render()) in the page request as the view_path parameter – for example, /admin/content. As nearly everywhere in Drupal 8, a leading slash is included.

However, in \Drupal\views\Controller\ViewAjaxController::ajaxView() there is then the following code dealing with this parameter:

$path = $request->request->get('view_path');
// …
$this->currentPath->setPath('/' . $path, $request);

As you can see, a second slash is prepended to the method argument. When other code then tries to get, e.g., the route match for that request, the router will throw a ResourceNotFoundException with message No routes found for "//admin/content"..
It seems there is normally just no code that does this (or otherwise uses the current path without left-trimming it first) during Views AJAX requests, so this bug could go undetected so far. But it does cause errors in combination with some contrib modules, like Facets.


Viewing all articles
Browse latest Browse all 300728

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>