🎨 Improve move doc

This commit is contained in:
Daniel 2024-03-15 23:11:46 +08:00
parent a00d42b286
commit 84c801bbc9
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

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