Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Fix tree id https://github.com/siyuan-note/siyuan/issues/14363

Daniel8418e3a454b4
diff --git a/kernel/filesys/tree.go b/kernel/filesys/tree.go
index c076156320..0e293a3ebc 100644
--- a/kernel/filesys/tree.go
+++ b/kernel/filesys/tree.go
@@ -278,6 +278,15 @@ func parseJSON2Tree(boxID, p string, jsonData []byte, luteEngine *lute.Lute) (re
needFix = true
logging.LogInfof("migrated tree [%s] from spec [%s] to [%s]", filePath, oldSpec, ret.Root.Spec)
}
+
+ if pathID := util.GetTreeID(p); pathID != ret.Root.ID {
+ needFix = true
+ ret.Root.ID = pathID
+ ret.ID = pathID
+ ret.Root.SetIALAttr("id", ret.ID)
+ logging.LogInfof("reset tree id from [%s] to [%s]", ret.Root.ID, pathID)
+ }
+
if needFix {
renderer := render.NewJSONRenderer(ret, luteEngine.RenderOptions)
data := renderer.Render()