From: kibigo! Date: Fri, 11 Nov 2022 03:14:52 +0000 (-0800) Subject: Also disallow entities inside of `` X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=d892dd8a268dbcd312deb6d06f92d863fd06e0f9;p=mastodon.git 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. --- diff --git a/app/lib/advanced_text_formatter.rb b/app/lib/advanced_text_formatter.rb index 573639514..ba6a5e868 100644 --- a/app/lib/advanced_text_formatter.rb +++ b/app/lib/advanced_text_formatter.rb @@ -71,7 +71,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)