Fix: WebDAV cannot move and rename at the same time (#1056)

pull/1073/head
WeidiDeng 3 years ago committed by GitHub
parent fce38209bc
commit 8c8ad3e149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save