diff --git a/core/lib/Drupal/Core/Routing/RoutePreloader.php b/core/lib/Drupal/Core/Routing/RoutePreloader.php index d0050c3..daa4130 100644 --- a/core/lib/Drupal/Core/Routing/RoutePreloader.php +++ b/core/lib/Drupal/Core/Routing/RoutePreloader.php @@ -98,7 +98,7 @@ protected function loadNonAdminRoutes() { public function onAlterRoutes(RouteBuildEvent $event) { $collection = $event->getRouteCollection(); foreach ($collection->all() as $name => $route) { - if (strpos($route->getPath(), '/admin') !== 0) { + if (strpos($route->getPath(), '/admin/') !== 0 && $route->getPath() != '/admin') { $this->nonAdminRoutesOnRebuild[] = $name; } } diff --git a/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php b/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php index 3154d36..334e903 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php @@ -103,13 +103,15 @@ public function testOnAlterRoutesWithAdminPathNoAdminRoute() { $route_collection = new RouteCollection(); $route_collection->add('test', new Route('/foo/admin/foo', array('_content' => 'Drupal\ExampleController'))); $route_collection->add('test2', new Route('/bar/admin/bar', array('_content' => 'Drupal\ExampleController'))); + $route_collection->add('test3', new Route('/administrator/a', array('_content' => 'Drupal\ExampleController'))); + $route_collection->add('test4', new Route('/admin', array('_content' => 'Drupal\ExampleController'))); $event->expects($this->once()) ->method('getRouteCollection') ->will($this->returnValue($route_collection)); $this->state->expects($this->once()) ->method('set') - ->with('routing.non_admin_routes', array('test', 'test2')); + ->with('routing.non_admin_routes', array('test', 'test2', 'test3')); $this->preloader->onAlterRoutes($event); $this->preloader->onFinishedRoutes(new Event()); }