Skip to content
Snippets Groups Projects
Verified Commit c981ed1c authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3491543 by mfb: symfony/http-foundation Follow up issue for isAdminPath validator

parent 97cb575e
Branches
Tags
12 merge requests!11197Issue #3506427 by eduardo morales alberti: Remove responsive_image.ajax from hook,!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!10786Issue #3490579 by shalini_jha, mstrelan: Add void return to all views...,!5423Draft: Resolve #3329907 "Test2",!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3478Issue #3337882: Deleted menus are not removed from content type config,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!579Issue #2230909: Simple decimals fail to pass validation,!213Issue #2906496: Give Media a menu item under Content
Pipeline #373032 passed with warnings
Pipeline: drupal

#373035

    ......@@ -7,8 +7,10 @@
    use Drupal\Core\Cache\CacheableDependencyInterface;
    use Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException;
    use Drupal\Core\Session\AccountInterface;
    use Symfony\Component\HttpFoundation\Exception\BadRequestException;
    use Symfony\Component\HttpFoundation\Request;
    use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
    use Symfony\Component\Routing\Exception\ResourceNotFoundException;
    use Symfony\Component\Routing\RouteCollection;
    use Symfony\Component\Routing\RequestContext as SymfonyRequestContext;
    use Symfony\Component\Routing\RouterInterface;
    ......@@ -138,7 +140,13 @@ public function generate($name, $parameters = [], $referenceType = self::ABSOLUT
    * Thrown when access checking failed.
    */
    public function match($pathinfo): array {
    return $this->matchRequest(Request::create($pathinfo));
    try {
    $request = Request::create($pathinfo);
    }
    catch (BadRequestException $e) {
    throw new ResourceNotFoundException($e->getMessage(), $e->getCode(), $e);
    }
    return $this->matchRequest($request);
    }
    }
    ......@@ -3,6 +3,7 @@
    namespace Drupal\Core\Routing;
    use Drupal\Core\Path\CurrentPathStack;
    use Symfony\Component\HttpFoundation\Exception\BadRequestException;
    use Symfony\Component\HttpFoundation\Request;
    use Symfony\Component\Routing\Exception\MethodNotAllowedException;
    use Symfony\Component\Routing\Exception\ResourceNotFoundException;
    ......@@ -98,7 +99,12 @@ public function addRouteEnhancer(EnhancerInterface $route_enhancer) {
    * {@inheritdoc}
    */
    public function match($pathinfo): array {
    try {
    $request = Request::create($pathinfo);
    }
    catch (BadRequestException $e) {
    throw new ResourceNotFoundException($e->getMessage(), $e->getCode(), $e);
    }
    return $this->matchRequest($request);
    }
    ......
    ......@@ -12,6 +12,7 @@
    use Drupal\Core\Routing\UrlGeneratorInterface;
    use Drupal\Tests\UnitTestCase;
    use Prophecy\Argument;
    use Symfony\Component\Routing\Exception\ResourceNotFoundException;
    use Symfony\Component\Routing\Route;
    use Symfony\Component\Routing\RouteCollection;
    ......@@ -59,6 +60,9 @@ public function testMatchesWithDifferentFitOrder(): void {
    $result = $router->match('/user/login');
    $this->assertEquals('user_login', $result['_route']);
    $this->expectException(ResourceNotFoundException::class);
    $router->match('/user/login ');
    }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment