Skip to content

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

:art: Improve kernel stability https://github.com/siyuan-note/siyuan/issues/9912

Danielad6edcae03ab
diff --git a/kernel/model/path.go b/kernel/model/path.go
index be9678ea68..0c25d6d731 100644
--- a/kernel/model/path.go
+++ b/kernel/model/path.go
@@ -52,9 +52,9 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数
return
}
} else {
+ retID = ast.NewNodeID()
if "" == id {
- id = ast.NewNodeID()
- retID = id
+ id = retID
}
}
@@ -95,10 +95,12 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数
root = hpathBtMap[hp]
isNotLast := i < len(parts)-1
if nil == root {
- if "" == retID {
- retID = ast.NewNodeID()
+ rootID := ast.NewNodeID()
+ if i == len(parts)-1 {
+ rootID = retID
}
- pathBuilder.WriteString(retID)
+
+ pathBuilder.WriteString(rootID)
docP := pathBuilder.String() + ".sy"
if isNotLast {
if _, err = createDoc(boxID, docP, part, ""); nil != err {
@@ -118,9 +120,6 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数
}
}
} else {
- if "" == retID {
- retID = root.ID
- }
pathBuilder.WriteString(root.ID)
if !isNotLast {
pathBuilder.WriteString(".sy")