🎇 finish move api
This commit is contained in:
@ -16,9 +16,9 @@ func Folder(c *gin.Context) {
|
||||
common.ErrorResp(c, err, 400)
|
||||
return
|
||||
}
|
||||
var files []model.File
|
||||
var files = make([]model.File, 0)
|
||||
var err error
|
||||
if model.AccountsCount() > 1 && req.Path == "/" {
|
||||
if model.AccountsCount() > 1 && (req.Path == "/" || req.Path == "") {
|
||||
files, err = model.GetAccountFiles()
|
||||
if err != nil {
|
||||
common.ErrorResp(c, err, 500)
|
||||
|
@ -3,6 +3,7 @@ package file
|
||||
import (
|
||||
"github.com/Xhofe/alist/drivers/base"
|
||||
"github.com/Xhofe/alist/drivers/operate"
|
||||
"github.com/Xhofe/alist/model"
|
||||
"github.com/Xhofe/alist/server/common"
|
||||
"github.com/Xhofe/alist/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -24,6 +25,10 @@ func Move(c *gin.Context) {
|
||||
common.ErrorStrResp(c, "Empty file names", 400)
|
||||
return
|
||||
}
|
||||
if model.AccountsCount() > 1 && (req.SrcDir == "/" || req.DstDir == "/") {
|
||||
common.ErrorStrResp(c, "Can't operate root folder", 400)
|
||||
return
|
||||
}
|
||||
srcAccount, srcPath, srcDriver, err := common.ParsePath(utils.Join(req.SrcDir, req.Names[0]))
|
||||
if err != nil {
|
||||
common.ErrorResp(c, err, 500)
|
||||
|
@ -77,7 +77,7 @@ func Path(c *gin.Context) {
|
||||
if meta != nil && meta.Upload {
|
||||
upload = true
|
||||
}
|
||||
if model.AccountsCount() > 1 && req.Path == "/" {
|
||||
if model.AccountsCount() > 1 && (req.Path == "/" || req.Path == "") {
|
||||
files, err := model.GetAccountFiles()
|
||||
if err != nil {
|
||||
common.ErrorResp(c, err, 500)
|
||||
|
Reference in New Issue
Block a user