diff --git a/app/lib/link_details_extractor.rb b/app/lib/link_details_extractor.rb index e67be33366d..5a2dc9bbca5 100644 --- a/app/lib/link_details_extractor.rb +++ b/app/lib/link_details_extractor.rb @@ -241,7 +241,7 @@ class LinkDetailsExtractor end def opengraph_tag(name) - head.at_xpath("//meta[@property='#{name}' or @name='#{name}'][@content]")&.attr('content') + head.xpath('//meta[@content]').find { |el| name.casecmp?(el['property']) || name.casecmp?(el['name']) }&.attr('content') end def meta_tag(name) diff --git a/spec/lib/link_details_extractor_spec.rb b/spec/lib/link_details_extractor_spec.rb index d65942d9023..4dec3c6d842 100644 --- a/spec/lib/link_details_extractor_spec.rb +++ b/spec/lib/link_details_extractor_spec.rb @@ -250,7 +250,7 @@ RSpec.describe LinkDetailsExtractor do - +