Skip to content

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

:bug: fix encrypted-notebook GetBlockTrees missing fallback for move boundary check #18034

Daniela2f93c9a725d
diff --git a/kernel/treenode/blocktree.go b/kernel/treenode/blocktree.go
index 7944929df3..7208340d36 100644
--- a/kernel/treenode/blocktree.go
+++ b/kernel/treenode/blocktree.go
@@ -409,6 +409,31 @@ func GetBlockTrees(ids []string) (ret map[string]*BlockTree) {
}
ret[block.ID] = &block
}
+
+ // 全局未命中的 id,遍历已打开的加密 box 查找
+ var missing []string
+ for _, id := range ids {
+ if _, ok := ret[id]; !ok {
+ missing = append(missing, id)
+ }
+ }
+ if len(missing) > 0 {
+ for _, encBoxID := range GetOpenedEncryptedBoxIDs() {
+ if len(missing) == 0 {
+ break
+ }
+ encRet := GetBlockTreesInBox(missing, encBoxID)
+ var stillMissing []string
+ for _, id := range missing {
+ if bt, ok := encRet[id]; ok {
+ ret[id] = bt
+ } else {
+ stillMissing = append(stillMissing, id)
+ }
+ }
+ missing = stillMissing
+ }
+ }
return
}