Skip to content

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

:art: https://github.com/siyuan-note/siyuan/pull/16268

Danielf5a1309481da
diff --git a/kernel/model/file.go b/kernel/model/file.go
index 4685ff3ce8..fe1ec9ba65 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -1073,12 +1073,13 @@ func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bo
SetBlockAttrs(retID, nameValues)
FlushTxQueue()
- docPath, _, err := GetPathByID(retID)
- if err != nil {
- logging.LogWarnf("get path by id [%s] failed: %s", retID, err)
+
+ bt := treenode.GetBlockTree(retID)
+ if nil == bt {
+ logging.LogWarnf("get block tree by id [%s] failed after create", retID)
return
}
- box.addMinSort(path.Dir(docPath), retID)
+ box.addMinSort(path.Dir(bt.Path), retID)
return
}