1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Handle OpenGraph property as case-insensitive

This commit is contained in:
Christian Schmidt 2024-08-09 17:21:43 +02:00
parent ab67866ac9
commit 7894a743c8
2 changed files with 2 additions and 2 deletions

View file

@ -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)

View file

@ -250,7 +250,7 @@ RSpec.describe LinkDetailsExtractor do
<head>
<meta property="og:url" content="https://example.com/dog.html">
<meta property="og:title" content="Man bites dog">
<meta property="og:description" content="A dog's tale">
<meta property="OG:description" content="A dog's tale">
<meta property="article:published_time" content="2022-01-31T19:53:00+00:00">
<meta property="og:author" content="Charlie Brown">
<meta property="og:locale" content="en">