An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Skip AV decryption for non-node-ID box paths and propagate parse errors https://github.com/siyuan-note/siyuan/issues/18034
Daniel8f109251f9b5
diff --git a/kernel/av/av.go b/kernel/av/av.goindex 89874bff30..da930a3f38 100644--- a/kernel/av/av.go+++ b/kernel/av/av.go@@ -623,6 +623,9 @@ func GetAttributeViewContent(avID string) (content string) {logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)return}+ if nil == attrView {+ return+ }return getAttributeViewContent0(attrView)}@@ -632,6 +635,9 @@ func GetAttributeViewContentByPath(avJSONPath string) (content string) {logging.LogErrorf("parse attribute view [%s] failed: %s", avJSONPath, err)return}+ if nil == attrView {+ return+ }return getAttributeViewContent0(attrView)}@@ -736,19 +742,19 @@ func parseAttributeViewByPathInBox(avJSONPath, boxID string) (ret *AttributeViewdata, readErr = filelock.ReadFile(avJSONPath)if nil != readErr {logging.LogErrorf("read attribute view [%s] failed: %s", avID, readErr)- return+ return nil, readErr}// 加密笔记本的 AV 定义是密文,按路径反查 boxID 后解密if boxID != "" {data, readErr = decryptAVDataLocked(boxID, avID, data)if readErr != nil {logging.LogErrorf("decrypt attribute view [%s] failed: %s", avID, readErr)- return+ return nil, readErr}} else if util.IsCiphertext(data) {// 历史等无法取得 boxID/DEK 的全局路径上读到密文:无法解密,返回空内容而非按 JSON 解析报错。// 这会在加密笔记本的 AV 因路径迁移(同步、导入、历史布局)落到全局位置时发生。- return+ return nil, nil}cache.SetAVDataInBox(avID, boxID, data)}diff --git a/kernel/av/encrypted_hook.go b/kernel/av/encrypted_hook.goindex 4ee093550d..24bef1bd84 100644--- a/kernel/av/encrypted_hook.go+++ b/kernel/av/encrypted_hook.go@@ -309,7 +309,8 @@ func avBoxIDFromPath(absPath string) string {}boxID := parts[0]// 全局路径的第一段是 "storage",加密笔记本路径的第一段是 boxID(节点 ID 格式)- if boxID == "storage" {+ // 历史等路径的第一段不是节点 ID,不视为 boxID,避免以错误身份触发解密+ if boxID == "storage" || !ast.IsNodeIDPattern(boxID) {return ""}return boxID