From 6f370460dc4e59fed3e4571d51468f8828d413d0 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 22 Jun 2024 00:26:57 +0800 Subject: [PATCH] :bug: https://github.com/siyuan-note/siyuan/issues/11776 https://github.com/siyuan-note/siyuan/issues/11773 --- kernel/treenode/blocktree.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/treenode/blocktree.go b/kernel/treenode/blocktree.go index 153429c35f8..82d1a169396 100644 --- a/kernel/treenode/blocktree.go +++ b/kernel/treenode/blocktree.go @@ -220,7 +220,7 @@ func GetBlockTreeRootByPath(boxID, path string) (ret *BlockTree) { func GetBlockTreeRootByHPath(boxID, hPath string) (ret *BlockTree) { ret = &BlockTree{} hPath = gulu.Str.RemoveInvisible(hPath) - sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ?" + sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND type = 'd'" err := db.QueryRow(sqlStmt, boxID, hPath).Scan(&ret.ID, &ret.RootID, &ret.ParentID, &ret.BoxID, &ret.Path, &ret.HPath, &ret.Updated, &ret.Type) if nil != err { ret = nil @@ -235,7 +235,7 @@ func GetBlockTreeRootByHPath(boxID, hPath string) (ret *BlockTree) { func GetBlockTreeRootsByHPath(boxID, hPath string) (ret []*BlockTree) { hPath = gulu.Str.RemoveInvisible(hPath) - sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ?" + sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND type = 'd'" rows, err := db.Query(sqlStmt, boxID, hPath) if nil != err { logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err) @@ -256,7 +256,7 @@ func GetBlockTreeRootsByHPath(boxID, hPath string) (ret []*BlockTree) { func GetBlockTreeRootByHPathPreferredParentID(boxID, hPath, preferredParentID string) (ret *BlockTree) { hPath = gulu.Str.RemoveInvisible(hPath) var roots []*BlockTree - sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND parent_id = ?" + sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND parent_id = ? AND type = 'd'" rows, err := db.Query(sqlStmt, boxID, hPath, preferredParentID) if nil != err { logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)