mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 15:01:10 +08:00
FIX: Internal oneboxes with github links (#22829)
Internal oneboxes to posts that contained oneboxed github links to commits or PRs with long enough commit messages to have the `show-more` and the `excerpt hidden` classes in their html were being stripped of their content resulting in empty internal oneboxes. see: https://meta.discourse.org/t/269436 This fixes a regression introduced in: 0b3cf83e3c7d03c2dcd54f86de60efe32f385a44
This commit is contained in:
@ -114,7 +114,11 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
||||
@in_quote = !@keep_onebox_source if attributes.include?(%w[class source])
|
||||
when "div", "span"
|
||||
attributes = Hash[*attributes.flatten]
|
||||
if attributes["class"]&.include?("excerpt")
|
||||
|
||||
# Only match "excerpt" class if it does specifically equal "excerpt
|
||||
# hidden" in order to prevent internal links with GitHub oneboxes from
|
||||
# being empty https://meta.discourse.org/t/269436
|
||||
if attributes["class"]&.include?("excerpt") && !attributes["class"]&.match?("excerpt hidden")
|
||||
@excerpt = +""
|
||||
@current_length = 0
|
||||
@start_excerpt = true
|
||||
|
Reference in New Issue
Block a user