From b26bbd34ddeb15e6737807d7ded2fa25b17c6edc Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Mon, 2 Dec 2024 10:32:07 +0100 Subject: [PATCH] Mvc/Router - normalize multiple leading slashes in paths, closes https://github.com/opnsense/core/issues/7709 --- src/opnsense/mvc/app/library/OPNsense/Mvc/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opnsense/mvc/app/library/OPNsense/Mvc/Router.php b/src/opnsense/mvc/app/library/OPNsense/Mvc/Router.php index dbc477552..dc91a8fcb 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Mvc/Router.php +++ b/src/opnsense/mvc/app/library/OPNsense/Mvc/Router.php @@ -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);