Skip to content

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

:art: Update kernel API getIDsByHPath https://github.com/siyuan-note/siyuan/issues/10091

Danielc378afe485e2
diff --git a/kernel/model/file.go b/kernel/model/file.go
index eb87493a50..7e007a6891 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -1199,6 +1199,7 @@ func GetFullHPathByID(id string) (hPath string, err error) {
}
func GetIDsByHPath(hpath, boxID string) (ret []string, err error) {
+ ret = []string{}
roots := treenode.GetBlockTreeRootsByHPath(boxID, hpath)
if 1 > len(roots) {
return
@@ -1208,6 +1209,9 @@ func GetIDsByHPath(hpath, boxID string) (ret []string, err error) {
ret = append(ret, root.ID)
}
ret = gulu.Str.RemoveDuplicatedElem(ret)
+ if 1 > len(ret) {
+ ret = []string{}
+ }
return
}