mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-17 18:18:07 +00:00
Also disallow entities inside of <code>
I think this is generally expected behaviour, and people are annoyed when their code gets turned into links/hashtags/mentions.
This commit is contained in:
@@ -69,7 +69,7 @@ class AdvancedTextFormatter < TextFormatter
|
|||||||
Sanitize.node!(@tree, Sanitize::Config::MASTODON_OUTGOING)
|
Sanitize.node!(@tree, Sanitize::Config::MASTODON_OUTGOING)
|
||||||
document = @tree.document
|
document = @tree.document
|
||||||
|
|
||||||
@tree.xpath('.//text()[not(ancestor::a)]').each do |text_node|
|
@tree.xpath('.//text()[not(ancestor::a | ancestor::code)]').each do |text_node|
|
||||||
# Iterate over text elements and build up their replacements.
|
# Iterate over text elements and build up their replacements.
|
||||||
content = text_node.content
|
content = text_node.content
|
||||||
replacement = Nokogiri::XML::NodeSet.new(document)
|
replacement = Nokogiri::XML::NodeSet.new(document)
|
||||||
|
|||||||
Reference in New Issue
Block a user