mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-10-10 04:53:09 +08:00
feat(fs): add cross-storage move support (#211)
* feat(fs): add cross-storage move support * fix(fs): add check before moving files * fix(fs): changed error detect method --------- Co-authored-by: ShenLin <773933146@qq.com>
This commit is contained in:
@@ -96,14 +96,24 @@ func FsMove(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
var addedTasks []task.TaskExtensionInfo
|
||||
for i, name := range req.Names {
|
||||
err := fs.Move(c, stdpath.Join(srcDir, name), dstDir, len(req.Names) > i+1)
|
||||
t, err := fs.MoveWithTask(c, stdpath.Join(srcDir, name), dstDir, len(req.Names) > i+1)
|
||||
if t != nil {
|
||||
addedTasks = append(addedTasks, t)
|
||||
}
|
||||
if err != nil {
|
||||
common.ErrorResp(c, err, 500)
|
||||
return
|
||||
}
|
||||
}
|
||||
common.SuccessResp(c)
|
||||
if len(addedTasks) > 0 {
|
||||
common.SuccessResp(c, gin.H{
|
||||
"tasks": getTaskInfos(addedTasks),
|
||||
})
|
||||
} else {
|
||||
common.SuccessResp(c)
|
||||
}
|
||||
}
|
||||
|
||||
func FsCopy(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user