From c378afe485e26d50f9af08705ccf1e672fb8b6c6 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 12 Jan 2024 09:41:08 +0800 Subject: [PATCH] :art: Update kernel API getIDsByHPath https://github.com/siyuan-note/siyuan/issues/10091 --- kernel/model/file.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/model/file.go b/kernel/model/file.go index eb87493a5..7e007a689 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 }