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

Handle meta name attribute as case-insensitive

This commit is contained in:
Christian Schmidt 2024-08-09 17:05:32 +02:00
parent 6e134e78af
commit ab67866ac9
2 changed files with 2 additions and 2 deletions

View file

@ -245,7 +245,7 @@ class LinkDetailsExtractor
end
def meta_tag(name)
document.xpath("//meta[@name=\"#{name}\"]").pick('content')
head.xpath('//meta[@name][@content]').find { |el| name.casecmp?(el['name']) }&.attr('content')
end
def structured_data

View file

@ -41,7 +41,7 @@ RSpec.describe LinkDetailsExtractor do
<html lang="en">
<head>
<title>Man bites dog</title>
<meta name="description" content="A dog&#39;s tale">
<meta name="descripTION" content="A dog&#39;s tale">
<link rel="pretty IcoN" href="/favicon.ico">
</head>
</html>