Skip to content

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

:art: Improve database block content escaping https://github.com/siyuan-note/siyuan/issues/14781

Daniel3b3dedefdb13
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 4f89c31c5f..f8447597ec 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -2903,7 +2903,9 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
if !operation.IsDetached {
bindBlockAv0(tx, operation.AvID, node, tree)
value.IsDetached = false
- value.Block.Icon, value.Block.Content = getNodeAvBlockText(node)
+ icon, content := getNodeAvBlockText(node)
+ content = util.UnescapeHTML(content)
+ value.Block.Icon, value.Block.Content = icon, content
value.UpdatedAt = now
err = av.SaveAttributeView(attrView)
}
@@ -2940,7 +2942,9 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
value.Block.ID = operation.NextID
value.IsDetached = operation.IsDetached
if !operation.IsDetached {
- value.Block.Icon, value.Block.Content = getNodeAvBlockText(node)
+ icon, content := getNodeAvBlockText(node)
+ content = util.UnescapeHTML(content)
+ value.Block.Icon, value.Block.Content = icon, content
}
}
diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go
index f5043dc15e..c9c83dd8a5 100644
--- a/kernel/model/blockinfo.go
+++ b/kernel/model/blockinfo.go
@@ -306,7 +306,6 @@ func getNodeAvBlockText(node *ast.Node) (icon, content string) {
if "" == content {
content = Conf.language(105)
}
-
return
}