From 42f7613bfae381e643eb7c19d2eccb1ba57fee7a Mon Sep 17 00:00:00 2001 From: xkeyC <3334969096@qq.com> Date: Wed, 29 Mar 2023 20:16:09 +0800 Subject: [PATCH] =?UTF-8?q?moveFiles=20=E4=BF=AE=E6=94=B9=E5=9B=9E?= =?UTF-8?q?=E6=97=A0=E6=9D=A1=E4=BB=B6=20overwrite=20=EF=BC=88Move=20?= =?UTF-8?q?=E6=88=96=20Rename=20=E9=83=BD=E4=BC=9A=E5=A4=84=E7=BD=9A?= =?UTF-8?q?=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/webdav/file.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/webdav/file.go b/pkg/webdav/file.go index c9e17ed..b36c1ed 100644 --- a/pkg/webdav/file.go +++ b/pkg/webdav/file.go @@ -38,13 +38,14 @@ func moveFiles(ctx context.Context, fs *filesystem.FileSystem, src FileInfo, dst fileIDs = []uint{src.(*model.File).ID} } + if overwrite { + if err := _checkOverwriteFile(ctx, fs, src, dst); err != nil { + return http.StatusInternalServerError, err + } + } + // 判断是否需要移动 if src.GetPosition() != path.Dir(dst) { - if overwrite { - if err := _checkOverwriteFile(ctx, fs, src, dst); err != nil { - return http.StatusInternalServerError, err - } - } err = fs.Move( ctx, folderIDs,