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:
Martin Brennan
2023-01-24 14:40:24 +10:00
committed by GitHub
parent 799202d50b
commit 63fdb6dd65
5 changed files with 39 additions and 5 deletions

View File

@ -216,7 +216,7 @@ module Email
correct_first_body_margin
correct_footer_style
correct_footer_style_highlight_first
decorate_hashtags
strip_hashtag_link_icons
reset_tables
html_lang = SiteSetting.default_locale.sub("_", "-")
@ -396,7 +396,7 @@ module Email
end
end
def decorate_hashtags
def strip_hashtag_link_icons
@fragment
.search(".hashtag-cooked")
.each do |hashtag|