浏览代码

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

Daniel 1 年之前
父节点
当前提交
c378afe485
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      kernel/model/file.go

+ 4 - 0
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
 }