Skip to content

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

:bug: Fix AV history path for encrypted notebooks and snapshot rendering https://github.com/siyuan-note/siyuan/issues/18034

Daniele04abc119c2e
diff --git a/kernel/model/history.go b/kernel/model/history.go
index e1165ecdc9..fe63ea9aac 100644
--- a/kernel/model/history.go
+++ b/kernel/model/history.go
@@ -964,10 +964,14 @@ func generateAvHistoryInTree(tree *parse.Tree, historyDir string) {
// 用 FindAttributeViewPath 解析 AV 定义的真实路径(自动路由全局/加密 box 笔记本级)
srcAvPath, _ := av.FindAttributeViewPath(avNode.AttributeViewID)
if srcAvPath == "" {
- // AV 定义不存在(可能尚未落盘或已删除),跳过
continue
}
+ // 普通笔记本保持原路径 historyDir/storage/av/;加密笔记本加 boxID 前缀(与文档历史
+ // 结构一致),让 indexHistoryDir 能从路径反查 boxID 判断是否加密
destAvPath := filepath.Join(historyDir, "storage", "av", avNode.AttributeViewID+".json")
+ if IsEncryptedBox(tree.Box) {
+ destAvPath = filepath.Join(historyDir, tree.Box, "storage", "av", avNode.AttributeViewID+".json")
+ }
if copyErr := filelock.Copy(srcAvPath, destAvPath); nil != copyErr {
logging.LogErrorf("copy av [%s] failed: %s", srcAvPath, copyErr)
}