diff --git a/kernel/model/file.go b/kernel/model/file.go index 046534a1d..e49ebcbe9 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -1238,6 +1238,16 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{}) pathsBoxes := getBoxesByPaths(fromPaths) + if 1 == len(fromPaths) { + // 移动到自己的父文档下的情况相当于不移动,直接返回 + if fromBox := pathsBoxes[fromPaths[0]]; nil != fromBox && fromBox.ID == toBoxID { + parentDir := path.Dir(fromPaths[0]) + if ("/" == toPath && "/" == parentDir) || (parentDir+".sy" == toPath) { + return + } + } + } + // 检查路径深度是否超过限制 for fromPath, fromBox := range pathsBoxes { childDepth := util.GetChildDocDepth(filepath.Join(util.DataDir, fromBox.ID, fromPath))