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:
parent
ab67866ac9
commit
7894a743c8
2 changed files with 2 additions and 2 deletions
|
@ -241,7 +241,7 @@ class LinkDetailsExtractor
|
||||||
end
|
end
|
||||||
|
|
||||||
def opengraph_tag(name)
|
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
|
end
|
||||||
|
|
||||||
def meta_tag(name)
|
def meta_tag(name)
|
||||||
|
|
|
@ -250,7 +250,7 @@ RSpec.describe LinkDetailsExtractor do
|
||||||
<head>
|
<head>
|
||||||
<meta property="og:url" content="https://example.com/dog.html">
|
<meta property="og:url" content="https://example.com/dog.html">
|
||||||
<meta property="og:title" content="Man bites dog">
|
<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="article:published_time" content="2022-01-31T19:53:00+00:00">
|
||||||
<meta property="og:author" content="Charlie Brown">
|
<meta property="og:author" content="Charlie Brown">
|
||||||
<meta property="og:locale" content="en">
|
<meta property="og:locale" content="en">
|
||||||
|
|
Loading…
Reference in a new issue