修复语言检测未匹配时的错误

优化分片上传

(cherry picked from commit ae57feebb6)
pull/413/MERGE
Karson 2023-12-14 17:57:38 +08:00 committed by F4nniu
parent 4f466551e2
commit b44f3791b1
2 changed files with 2 additions and 2 deletions

View File

@ -305,7 +305,7 @@ class Upload
$attachment = $this->upload();
} catch (\Exception $e) {
@unlink($destFile);
@unlink($uploadPath);
throw new UploadException($e->getMessage());
}
return $attachment;

View File

@ -19,7 +19,7 @@ if (isset($_GET['lang'])) {
$langSet = strtolower($_COOKIE['think_var']);
} elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);
$langSet = strtolower($matches[1]);
$langSet = strtolower($matches[1] ?? '');
}
$langSet = $langSet && in_array($langSet, ['zh-cn', 'en']) ? $langSet : 'zh-cn';
$langSet == 'en' && $lang = array_combine(array_keys($lang), array_keys($lang));