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( )
{
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' );
}