fix: ignore extraneous slashes in paths

This commit is contained in:
Emmanuel BENOîT 2025-01-05 19:03:14 +01:00
parent da760ee4a3
commit 5320ba3e11
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg

View file

@ -28,9 +28,8 @@ final class URLMapper
public function fromPathInfo( ) public function fromPathInfo( )
{ {
if ( array_key_exists( 'PATH_INFO' , $_SERVER ) ) { $path = rtrim( preg_replace( '/\/\/+/g', '/', $_SERVER[ 'PATH_INFO' ] ?? '') , '/' );
$path = $_SERVER[ 'PATH_INFO' ]; if ( !$path ) {
} else {
$path = '/' . $this->package->config( $this->configBase . '/default' , 'home' ); $path = '/' . $this->package->config( $this->configBase . '/default' , 'home' );
} }