chore(src): 更新上传的判断路径的逻辑
This commit is contained in:
@@ -894,11 +894,12 @@ class Upload extends BaseModel
|
||||
$current_user = $current_user ? $current_user : 'unknown';
|
||||
$current_work_dir = getcwd();
|
||||
$current_work_dir = $current_work_dir ? $current_work_dir : 'unknown';
|
||||
// 如果$path包含工作目录,需要转换为绝对路径
|
||||
// 如果$path不是以工作目录开头,需要添加工作目录
|
||||
$absolute_path = $path;
|
||||
if (strpos($path, $current_work_dir) !== false) {
|
||||
if (!strpos($path, $current_work_dir)) {
|
||||
$absolute_path = $current_work_dir . "/" . $path;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
if (file_exists($absolute_path) || mkdir($absolute_path, 0755, true)) {
|
||||
|
||||
Reference in New Issue
Block a user