fix: CopyUploadFile文件复制判断非目录
This commit is contained in:
@@ -317,7 +317,7 @@ func CopyUploadFile(filePath, dst string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 如果目标文件已经存在,先将目标文件重命名
|
// 如果目标文件已经存在,先将目标文件重命名
|
||||||
if _, err := os.Stat(dst); err == nil {
|
if info, err := os.Stat(dst); err == nil && !info.IsDir() {
|
||||||
ext := filepath.Ext(dst)
|
ext := filepath.Ext(dst)
|
||||||
name := dst[0 : len(dst)-len(ext)]
|
name := dst[0 : len(dst)-len(ext)]
|
||||||
newName := fmt.Sprintf("%s-%s%s", name, time.Now().Format("20060102_150405"), ext)
|
newName := fmt.Sprintf("%s-%s%s", name, time.Now().Format("20060102_150405"), ext)
|
||||||
|
|||||||
Reference in New Issue
Block a user