DEV: use HTML5 version of loofah (#21522)

https://meta.discourse.org/t/markdown-preview-and-result-differ/263878

The result of this markdown had different results in the composer preview and the post. This is solved by updating Loofah to the latest version and using html5 fragments like our user had reported. While the change was only needed in cooked_post_processor.rb for this fix, other areas also had to be updated due to various side effects.
This commit is contained in:
Sam
2023-06-20 11:49:22 +10:00
committed by GitHub
parent a999deaab9
commit 9e241e82e9
15 changed files with 123 additions and 115 deletions

View File

@@ -10,10 +10,10 @@ class PostHotlinkedMedia < ActiveRecord::Base
upload_create_failed: "upload_create_failed",
}
def self.normalize_src(src)
def self.normalize_src(src, reset_scheme: true)
uri = Addressable::URI.heuristic_parse(src)
uri.normalize!
uri.scheme = nil
uri.scheme = nil if reset_scheme
uri.to_s
rescue URI::Error, Addressable::URI::InvalidURIError
src