From ae068204284bca5967b370302e9b68e62100346d Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 10 Nov 2022 19:14:52 -0800 Subject: [PATCH] Also disallow entities inside of `` I think this is generally expected behaviour, and people are annoyed when their code gets turned into links/hashtags/mentions. --- app/lib/advanced_text_formatter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/advanced_text_formatter.rb b/app/lib/advanced_text_formatter.rb index 4917f8e6f..4fa574984 100644 --- a/app/lib/advanced_text_formatter.rb +++ b/app/lib/advanced_text_formatter.rb @@ -69,7 +69,7 @@ class AdvancedTextFormatter < TextFormatter Sanitize.node!(@tree, Sanitize::Config::MASTODON_OUTGOING) 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. content = text_node.content replacement = Nokogiri::XML::NodeSet.new(document)