From 1dbfd930fb8ec53a3989463279ede31ae54dd349 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Fri, 22 Oct 2021 16:08:00 +0800 Subject: [PATCH] fix:#769 --- server/utils/file_operations.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/utils/file_operations.go b/server/utils/file_operations.go index 0444a74c..497caa79 100644 --- a/server/utils/file_operations.go +++ b/server/utils/file_operations.go @@ -1,6 +1,7 @@ package utils import ( + "errors" "os" "path/filepath" "reflect" @@ -25,6 +26,10 @@ func FileMove(src string, dst string) (err error) { if err != nil { return err } + _, err = os.Stat(dst) + if err == nil { + return errors.New("文件已存在") + } var revoke = false dir := filepath.Dir(dst) Redirect: