Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix encrypted-notebook blocktree_fix not box-scoped #18034

Daniel322cc78b7e20
diff --git a/kernel/treenode/blocktree_fix.go b/kernel/treenode/blocktree_fix.go
index 472d9a9af2..7fddc4cd28 100644
--- a/kernel/treenode/blocktree_fix.go
+++ b/kernel/treenode/blocktree_fix.go
@@ -36,7 +36,7 @@ func getRedundantPaths(boxID string, paths []string) (ret []string) {
btPathsMap := map[string]bool{}
sqlStmt := "SELECT path FROM blocktrees WHERE box_id = ?"
- rows, err := db.Query(sqlStmt, boxID)
+ rows, err := queryForBox(boxID, sqlStmt, boxID)
if err != nil {
logging.LogErrorf("query block tree failed: %s", err)
return
@@ -62,7 +62,7 @@ func getRedundantPaths(boxID string, paths []string) (ret []string) {
func removeBlockTreesByPath(boxID, path string) {
sqlStmt := "DELETE FROM blocktrees WHERE box_id = ? AND path = ?"
- _, err := db.Exec(sqlStmt, boxID, path)
+ _, err := execForBox(boxID, sqlStmt, boxID, path)
if err != nil {
logging.LogErrorf("delete block tree failed: %s", err)
}
@@ -76,7 +76,7 @@ func GetNotExistPaths(boxID string, paths []string) (ret []string) {
btPathsMap := map[string]bool{}
sqlStmt := "SELECT path FROM blocktrees WHERE box_id = ?"
- rows, err := db.Query(sqlStmt, boxID)
+ rows, err := queryForBox(boxID, sqlStmt, boxID)
if err != nil {
logging.LogErrorf("query block tree failed: %s", err)
return