From d2fd1f3a0571f8d78d6ca2797a6f39d5a929da18 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 28 Sep 2021 11:01:44 +0800 Subject: [PATCH 1/2] try fix filename have [] in FC --- platform/AliyunFC.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/AliyunFC.php b/platform/AliyunFC.php index ad27a9c..7d602f6 100644 --- a/platform/AliyunFC.php +++ b/platform/AliyunFC.php @@ -37,7 +37,7 @@ function GetPathSetting($event, $context) $_SERVER['region'] = $context['region']; $_SERVER['service_name'] = $context['service']['name']; $_SERVER['function_name'] = $context['function']['name']; - $path = $event['path']; + $path = str_replace('%5D', ']', str_replace('%5B', '[', $event['path'])); $tmp = $event['requestURI']; if (strpos($tmp, '?')) $tmp = substr($tmp, 0, strpos($tmp, '?')); if ($path=='/'||$path=='') { From 45a7b1e3034adebb312269e1d5e5e5d1fd97832d Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 28 Sep 2021 12:47:06 +0800 Subject: [PATCH 2/2] try fix filename have () or other in FC --- platform/AliyunFC.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/AliyunFC.php b/platform/AliyunFC.php index 7d602f6..184879d 100644 --- a/platform/AliyunFC.php +++ b/platform/AliyunFC.php @@ -37,14 +37,15 @@ function GetPathSetting($event, $context) $_SERVER['region'] = $context['region']; $_SERVER['service_name'] = $context['service']['name']; $_SERVER['function_name'] = $context['function']['name']; - $path = str_replace('%5D', ']', str_replace('%5B', '[', $event['path'])); - $tmp = $event['requestURI']; + $path = urldecode($event['path']); + $tmp = urldecode($event['requestURI']); if (strpos($tmp, '?')) $tmp = substr($tmp, 0, strpos($tmp, '?')); if ($path=='/'||$path=='') { $_SERVER['base_path'] = $tmp; } else { $_SERVER['base_path'] = substr($tmp, 0, strlen($tmp)-strlen($path)+1); } + $_SERVER['base_path'] = spurlencode($_SERVER['base_path'], '/'); if (substr($path,-1)=='/') $path=substr($path,0,-1); $_SERVER['is_guestup_path'] = is_guestup_path($path); @@ -60,8 +61,9 @@ function GetPathSetting($event, $context) $_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto'][0]; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2]; + $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'][0]; $_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2'; - return $path; + return spurlencode($path, '/'); } function getConfig($str, $disktag = '')