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

This commit is contained in:
Daniel 2025-05-08 12:28:09 +08:00
parent 74c66129f2
commit 3b3dedefdb
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 6 additions and 3 deletions

View file

@ -2903,7 +2903,9 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
if !operation.IsDetached { if !operation.IsDetached {
bindBlockAv0(tx, operation.AvID, node, tree) bindBlockAv0(tx, operation.AvID, node, tree)
value.IsDetached = false 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 value.UpdatedAt = now
err = av.SaveAttributeView(attrView) err = av.SaveAttributeView(attrView)
} }
@ -2940,7 +2942,9 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
value.Block.ID = operation.NextID value.Block.ID = operation.NextID
value.IsDetached = operation.IsDetached value.IsDetached = operation.IsDetached
if !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
} }
} }

View file

@ -306,7 +306,6 @@ func getNodeAvBlockText(node *ast.Node) (icon, content string) {
if "" == content { if "" == content {
content = Conf.language(105) content = Conf.language(105)
} }
return return
} }