mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 02:01:15 +08:00
FIX: Do not add empty use/svg tags in ExcerptParser (#19969)
There was an issue where if hashtag-cooked HTML was sent to the ExcerptParser without the keep_svg option, we would end up with empty </use> and </svg> tags on the parts of the excerpt where the hashtag was, in this case when a post push notification was sent. Fixed this, and also added a way to only display a plaintext version of the hashtag for cases like this via PrettyText#excerpt.
This commit is contained in:
@ -181,10 +181,10 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
||||
when "div", "span"
|
||||
throw :done if @start_excerpt
|
||||
when "svg"
|
||||
characters("</svg>", truncate: false, count_it: false, encode: false)
|
||||
characters("</svg>", truncate: false, count_it: false, encode: false) if @keep_svg
|
||||
@in_svg = false
|
||||
when "use"
|
||||
characters("</use>", truncate: false, count_it: false, encode: false)
|
||||
characters("</use>", truncate: false, count_it: false, encode: false) if @keep_svg
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user