Skip to content

Commit

Permalink
🐛 #11776 #11773
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jun 21, 2024
1 parent 1452e7c commit 6f37046
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/treenode/blocktree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 6f37046

Please sign in to comment.