From 0d4c63e9ff6a4d542c5cee1d5ca56cf9f6102276 Mon Sep 17 00:00:00 2001 From: Jealous Date: Mon, 27 Jan 2025 20:09:17 +0800 Subject: [PATCH] feat(fs): display the existing filename in error message (#7877) --- server/handles/fsmanage.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/handles/fsmanage.go b/server/handles/fsmanage.go index 9349e7e2..c527464e 100644 --- a/server/handles/fsmanage.go +++ b/server/handles/fsmanage.go @@ -90,7 +90,7 @@ func FsMove(c *gin.Context) { 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, "file exists", 403) + common.ErrorStrResp(c, fmt.Sprintf("file [%s] exists", name), 403) return } } @@ -133,7 +133,7 @@ func FsCopy(c *gin.Context) { 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, "file exists", 403) + common.ErrorStrResp(c, fmt.Sprintf("file [%s] exists", name), 403) return } } @@ -180,7 +180,7 @@ func FsRename(c *gin.Context) { dstPath := stdpath.Join(stdpath.Dir(reqPath), req.Name) if dstPath != reqPath { 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 } }