Skip to content

Commit

Permalink
Merge pull request Kunstmaan#3471 from insiders/redirect-space
Browse files Browse the repository at this point in the history
[RedirectBundle] Redirect with spaces
  • Loading branch information
acrobat authored Feb 2, 2025
2 parents 62e58f6 + eb00527 commit 7cef804
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Kunstmaan/RedirectBundle/Router/RedirectRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private function initRouteCollection(string $pathInfo): void
}
}

$route = new Route($routePath, [
$route = new Route(urldecode($routePath), [
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction',
'path' => $targetPath,
'permanent' => $redirect->isPermanent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function urlProviderForImprovedRouter(): iterable
yield 'Wildcard root origin to wildcard root target redirect with query params' => ['/test/abc/def?query=test', 'https://www.google.com/test/abc/def?query=test', $this->getRedirect(12, '/*', 'https://www.google.com/*')];
yield 'Wildcard root origin to wildcard root target with root path should not redirect' => ['/', null, $this->getRedirect(13, '/*', 'https://www.google.com/*')];
yield 'Redirect with query params' => ['/test?query=test', 'https://www.google.com/test?query=test', $this->getRedirect(14, '/test', 'https://www.google.com/test')];
yield 'Wildcard root origin to wildcard root target redirect with spaces' => ['/test/abc/%20def?query=test', 'https://www.google.com/test/abc/%20def?query=test', $this->getRedirect(15, '/*', 'https://www.google.com/*')];
}

private function getRedirect(int $id, string $origin, string $target, bool $permanent = false, ?string $domain = null): Redirect
Expand Down

0 comments on commit 7cef804

Please sign in to comment.