修复webdav不能同时移动位置和重命名

pull/1056/head
WeidiDeng 4 years ago committed by GitHub
parent 532bff820a
commit 077528aa47
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