diff options
author | Daniel Aleksandersen <code@daniel.priv.no> | 2019-04-21 04:48:19 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-04-21 04:48:19 +0200 |
commit | 10bdd912d64a45d8b445f33cd10e498d8c071e56 (patch) | |
tree | 18954400721c98c4a4d29b05685f8b49cf968862 /app | |
parent | 01b1c377b1fea841b9823a3134e8f41ccc4b0f29 (diff) |
Treat meta[property] as a space-separated list (#10604)
The @property attribute in HTML is a space-separated list of values. This change normalizes whitespace and finds the desired value in the list instead of requiring an exact single-value match. More details: https://www.ctrl.blog/entry/rdfa-socialmedia-metadata.html
Diffstat (limited to 'app')
-rw-r--r-- | app/services/fetch_link_card_service.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb index 7979c312e..494aaed75 100644 --- a/app/services/fetch_link_card_service.rb +++ b/app/services/fetch_link_card_service.rb @@ -165,7 +165,7 @@ class FetchLinkCardService < BaseService end def meta_property(page, property) - page.at_xpath("//meta[@property=\"#{property}\"]")&.attribute('content')&.value || page.at_xpath("//meta[@name=\"#{property}\"]")&.attribute('content')&.value + page.at_xpath("//meta[contains(concat(' ', normalize-space(@property), ' '), ' #{property} ')]")&.attribute('content')&.value || page.at_xpath("//meta[@name=\"#{property}\"]")&.attribute('content')&.value end def lock_options |