]> cat aescling's git repositories - mastodon.git/commitdiff
Fix local text/html toots not being sanitized
authorThibaut Girka <thib@sitedethib.com>
Tue, 21 May 2019 20:57:59 +0000 (22:57 +0200)
committerThibG <thib@sitedethib.com>
Tue, 21 May 2019 21:12:43 +0000 (23:12 +0200)
app/lib/formatter.rb

index 78a0e9f254d0ab0af30a3013c34b7925a297719b..a099ff7282270d628ad30464ced0f29b79b677dc 100644 (file)
@@ -61,7 +61,9 @@ class Formatter
     html = encode_and_link_urls(html, linkable_accounts, keep_html: %w(text/markdown text/html).include?(status.content_type))
     html = encode_custom_emojis(html, status.emojis, options[:autoplay]) if options[:custom_emojify]
 
-    unless %w(text/markdown text/html).include?(status.content_type)
+    if %w(text/markdown text/html).include?(status.content_type)
+      html = reformat(html)
+    else
       html = simple_format(html, {}, sanitize: false)
       html = html.delete("\n")
     end
@@ -70,7 +72,7 @@ class Formatter
   end
 
   def format_markdown(html)
-    html = reformat(markdown_formatter.render(html))
+    html = markdown_formatter.render(html)
     html.delete("\r").delete("\n")
   end