From 5320ba3e11d22ab7c1595e01e7823401515b5970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20BENO=C3=8ET?= Date: Sun, 5 Jan 2025 19:03:14 +0100 Subject: [PATCH] fix: ignore extraneous slashes in paths --- includes/core/urls.inc.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/core/urls.inc.php b/includes/core/urls.inc.php index 479fc1f..1ec0548 100644 --- a/includes/core/urls.inc.php +++ b/includes/core/urls.inc.php @@ -28,9 +28,8 @@ final class URLMapper public function fromPathInfo( ) { - if ( array_key_exists( 'PATH_INFO' , $_SERVER ) ) { - $path = $_SERVER[ 'PATH_INFO' ]; - } else { + $path = rtrim( preg_replace( '/\/\/+/g', '/', $_SERVER[ 'PATH_INFO' ] ?? '') , '/' ); + if ( !$path ) { $path = '/' . $this->package->config( $this->configBase . '/default' , 'home' ); }