fixed(fs):fixed overwrite functions (#469)

* fixed(fs):fixed overwrite functions
This commit is contained in:
Suyunjing
2025-06-29 12:17:23 +08:00
committed by GitHub
parent 060fd36883
commit 4590795cba

View File

@ -88,6 +88,15 @@ func FsMove(c *gin.Context) {
common.ErrorResp(c, err, 403)
return
}
if !req.Overwrite {
for _, name := range req.Names {
if res, _ := fs.Get(c, stdpath.Join(dstDir, name), &fs.GetArgs{NoLog: true}); res != nil {
common.ErrorStrResp(c, fmt.Sprintf("file [%s] exists", name), 403)
return
}
}
}
// Create all tasks immediately without any synchronous validation
// All validation will be done asynchronously in the background
@ -141,6 +150,15 @@ func FsCopy(c *gin.Context) {
common.ErrorResp(c, err, 403)
return
}
if !req.Overwrite {
for _, name := range req.Names {
if res, _ := fs.Get(c, stdpath.Join(dstDir, name), &fs.GetArgs{NoLog: true}); res != nil {
common.ErrorStrResp(c, fmt.Sprintf("file [%s] exists", name), 403)
return
}
}
}
// Create all tasks immediately without any synchronous validation
// All validation will be done asynchronously in the background