An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Failed to rename the document after moving it https://github.com/siyuan-note/siyuan/issues/11661
Daniel1b7be9b6f086
diff --git a/kernel/model/box.go b/kernel/model/box.goindex 3e5e100f44..4fffcd864a 100644--- a/kernel/model/box.go+++ b/kernel/model/box.go@@ -404,12 +404,9 @@ func moveTree(tree *parse.Tree) {func (box *Box) renameSubTrees(tree *parse.Tree) {subFiles := box.ListFiles(tree.Path)- box.moveTrees0(subFiles)-}-func (box *Box) moveTrees0(files []*FileInfo) {luteEngine := util.NewLute()- for _, subFile := range files {+ for _, subFile := range subFiles {if !strings.HasSuffix(subFile.path, ".sy") {continue}diff --git a/kernel/model/file.go b/kernel/model/file.goindex 62d8ca02a9..56ff363460 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -1477,7 +1477,8 @@ func moveDoc(fromBox *Box, fromPath string, toBox *Box, toPath string, luteEngin}}- if fromBox.Exist(fromFolder) {+ needMoveSubDocs := fromBox.Exist(fromFolder)+ if needMoveSubDocs {// 移动子文档文件夹newFolder := path.Join(toFolder, tree.ID)@@ -1532,6 +1533,28 @@ func moveDoc(fromBox *Box, fromPath string, toBox *Box, toPath string, luteEnginmoveSorts(tree.ID, fromBox.ID, toBox.ID)}+ if needMoveSubDocs {+ // 将其所有子文档的移动事件推送到前端 https://github.com/siyuan-note/siyuan/issues/11661+ subDocsFolder := path.Join(toFolder, tree.ID)+ syFiles := listSyFiles(path.Join(toBox.ID, subDocsFolder))+ for _, syFile := range syFiles {+ relPath := strings.TrimPrefix(syFile, "/"+path.Join(toBox.ID, toFolder))+ subFromPath := path.Join(path.Dir(fromPath), relPath)+ subToPath := path.Join(toFolder, relPath)++ evt := util.NewCmdResult("moveDoc", 0, util.PushModeBroadcast)+ evt.Data = map[string]interface{}{+ "fromNotebook": fromBox.ID,+ "fromPath": subFromPath,+ "toNotebook": toBox.ID,+ "toPath": path.Dir(subToPath) + ".sy",+ "newPath": subToPath,+ }+ evt.Callback = callback+ util.PushEvent(evt)+ }+ }+evt := util.NewCmdResult("moveDoc", 0, util.PushModeBroadcast)evt.Data = map[string]interface{}{"fromNotebook": fromBox.ID,