fix: get wrong ext

pull/453/merge
qkqpttgf 2022-09-21 15:32:15 +08:00 committed by GitHub
parent cc0fd539a1
commit 0a83622087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -51,13 +51,13 @@ function GetPathSetting($event, $context)
$_SERVER['ProjectID'] = $context->getProjectID(); $_SERVER['ProjectID'] = $context->getProjectID();
$host_name = $event['headers']['host']; $host_name = $event['headers']['host'];
$_SERVER['HTTP_HOST'] = $host_name; $_SERVER['HTTP_HOST'] = $host_name;
$path = path_format($event['pathParameters'][''].'/'); $path = path_format('/' . $event['pathParameters']['']);
$path = str_replace('+', '%2B', $path); $path = str_replace('+', '%2B', $path);
$_SERVER['base_path'] = path_format($event['path'].'/'); $_SERVER['base_path'] = path_format($event['path']);
if ( $_SERVER['base_path'] == $path ) { if ( $_SERVER['base_path'] == $path ) {
$_SERVER['base_path'] = '/'; $_SERVER['base_path'] = '/';
} else { } else {
$_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path)); $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, strlen($_SERVER['base_path'])-strlen($path));
if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/'; if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/';
} }
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);