|
|
@ -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
|
|
|
|