Fixed duplicated slashes generated in path when doing not-found redirects with placeholders

This commit is contained in:
Alejandro Celaya
2022-01-16 15:54:22 +01:00
parent 77fee1390f
commit 492eba3a8b
2 changed files with 6 additions and 3 deletions

View File

@@ -70,7 +70,10 @@ class NotFoundRedirectResolver implements NotFoundRedirectResolverInterface
$replacePlaceholderForPattern(self::DOMAIN_PLACEHOLDER, $domain, $modifier),
$replacePlaceholderForPattern(self::ORIGINAL_PATH_PLACEHOLDER, $path, $modifier),
);
$replacePlaceholdersInPath = $replacePlaceholders('\Functional\id');
$replacePlaceholdersInPath = compose(
$replacePlaceholders('\Functional\id'),
static fn (?string $path) => $path === null ? null : str_replace('//', '/', $path), // Fix duplicated bars
);
$replacePlaceholdersInQuery = $replacePlaceholders('\urlencode');
return $redirectUri