Mvc/Router - normalize multiple leading slashes in paths, closes https://github.com/opnsense/core/issues/7709

This commit is contained in:
Ad Schellevis 2024-12-02 10:32:07 +01:00
parent 01fc795f34
commit b26bbd34dd

View File

@ -115,7 +115,7 @@ class Router
*/
public function routeRequest(string $uri, array $defaults = []): Response
{
$path = parse_url($uri)['path'];
$path = parse_url('/'.ltrim($uri, '/'))['path'] ?? '';
if (!str_starts_with($path, $this->prefix)) {
throw new InvalidUriException("Invalid route path: " . $uri);