feat(fs): display the existing filename in error message (#7877)
This commit is contained in:
parent
5c5d8378e5
commit
0d4c63e9ff
@ -90,7 +90,7 @@ func FsMove(c *gin.Context) {
|
|||||||
if !req.Overwrite {
|
if !req.Overwrite {
|
||||||
for _, name := range req.Names {
|
for _, name := range req.Names {
|
||||||
if res, _ := fs.Get(c, stdpath.Join(dstDir, name), &fs.GetArgs{NoLog: true}); res != nil {
|
if res, _ := fs.Get(c, stdpath.Join(dstDir, name), &fs.GetArgs{NoLog: true}); res != nil {
|
||||||
common.ErrorStrResp(c, "file exists", 403)
|
common.ErrorStrResp(c, fmt.Sprintf("file [%s] exists", name), 403)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ func FsCopy(c *gin.Context) {
|
|||||||
if !req.Overwrite {
|
if !req.Overwrite {
|
||||||
for _, name := range req.Names {
|
for _, name := range req.Names {
|
||||||
if res, _ := fs.Get(c, stdpath.Join(dstDir, name), &fs.GetArgs{NoLog: true}); res != nil {
|
if res, _ := fs.Get(c, stdpath.Join(dstDir, name), &fs.GetArgs{NoLog: true}); res != nil {
|
||||||
common.ErrorStrResp(c, "file exists", 403)
|
common.ErrorStrResp(c, fmt.Sprintf("file [%s] exists", name), 403)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ func FsRename(c *gin.Context) {
|
|||||||
dstPath := stdpath.Join(stdpath.Dir(reqPath), req.Name)
|
dstPath := stdpath.Join(stdpath.Dir(reqPath), req.Name)
|
||||||
if dstPath != reqPath {
|
if dstPath != reqPath {
|
||||||
if res, _ := fs.Get(c, dstPath, &fs.GetArgs{NoLog: true}); res != nil {
|
if res, _ := fs.Get(c, dstPath, &fs.GetArgs{NoLog: true}); res != nil {
|
||||||
common.ErrorStrResp(c, "file exists", 403)
|
common.ErrorStrResp(c, fmt.Sprintf("file [%s] exists", req.Name), 403)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user