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,21 +38,24 @@ 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(
// 判断是否需要重命名
if err == nil && src.GetName() != path.Base(dst) {
err = fs.Rename(
ctx, ctx,
folderIDs, folderIDs,
fileIDs, fileIDs,
src.GetPosition(), path.Base(dst),
path.Dir(dst),
) )
} }

Loading…
Cancel
Save