🐛 The save path is incorrect when creating a sub-doc by ref in a doc with the same name https://github.com/siyuan-note/siyuan/issues/8138

This commit is contained in:
Daniel 2024-09-23 12:07:50 +08:00
parent d21b122429
commit 5ad9de9541
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 4 additions and 4 deletions

View file

@ -258,10 +258,10 @@ func GetBlockTreeRootsByHPath(boxID, hPath string) (ret []*BlockTree) {
return
}
func GetBlockTreeRootByHPathPreferredParentID(boxID, hPath, preferredParentID string) (ret *BlockTree) {
func GetBlockTreeByHPathPreferredParentID(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 = ? AND type = 'd'"
sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND parent_id = ? LIMIT 1"
rows, err := db.Query(sqlStmt, boxID, hPath, preferredParentID)
if err != nil {
logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)