Merge remote-tracking branch 'origin/master'

pull/1073/head
HFO4 3 years ago
commit 51b1e5b854

@ -38,23 +38,26 @@ func moveFiles(ctx context.Context, fs *filesystem.FileSystem, src FileInfo, dst
fileIDs = []uint{src.(*model.File).ID} fileIDs = []uint{src.(*model.File).ID}
} }
// 判断是否为重命名 // 判断是否需要移动
if src.GetPosition() == path.Dir(dst) { if src.GetPosition() != path.Dir(dst) {
err = fs.Rename( err = fs.Move(
ctx, ctx,
folderIDs, folderIDs,
fileIDs, fileIDs,
path.Base(dst), src.GetPosition(),
) path.Dir(dst),
} else { )
err = fs.Move( }
ctx,
folderIDs, // 判断是否需要重命名
fileIDs, if err == nil && src.GetName() != path.Base(dst) {
src.GetPosition(), err = fs.Rename(
path.Dir(dst), ctx,
) folderIDs,
} fileIDs,
path.Base(dst),
)
}
if err != nil { if err != nil {
return http.StatusInternalServerError, err return http.StatusInternalServerError, err

Loading…
Cancel
Save