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.