From 7894a743c8d580fd794cf593e3de0db756e52066 Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Fri, 9 Aug 2024 17:21:43 +0200 Subject: [PATCH] Handle OpenGraph property as case-insensitive --- app/lib/link_details_extractor.rb | 2 +- spec/lib/link_details_extractor_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 - +