From 3b3dedefdb130f14019d8be89bae8b058d91d269 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 8 May 2025 12:28:09 +0800 Subject: [PATCH] :art: Improve database block content escaping https://github.com/siyuan-note/siyuan/issues/14781 --- kernel/model/attribute_view.go | 8 ++++++-- kernel/model/blockinfo.go | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 4f89c31c5..f8447597e 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 f5043dc15..c9c83dd8a 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 }