diff options
author | Effy Elden <effy@effy.space> | 2023-01-05 23:36:24 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 13:36:24 +0100 |
commit | 4dc9152b3e8e390aa18f823e0f5498cd02b8b496 (patch) | |
tree | 9ccc645e8fa68864d9f70ed48ff693f56ccffc48 /app | |
parent | 70b3207e33743290e55b67a4b88cddbed36c1903 (diff) |
Be more lenient with OEmbed detection and validation (#22533)
Diffstat (limited to 'app')
-rw-r--r-- | app/services/fetch_oembed_service.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/services/fetch_oembed_service.rb b/app/services/fetch_oembed_service.rb index 4cbaa04c6..7d0879c79 100644 --- a/app/services/fetch_oembed_service.rb +++ b/app/services/fetch_oembed_service.rb @@ -28,7 +28,7 @@ class FetchOEmbedService page = Nokogiri::HTML(html) if @format.nil? || @format == :json - @endpoint_url ||= page.at_xpath('//link[@type="application/json+oembed"]')&.attribute('href')&.value + @endpoint_url ||= page.at_xpath('//link[@type="application/json+oembed"]|//link[@type="text/json+oembed"]')&.attribute('href')&.value @format ||= :json if @endpoint_url end @@ -100,7 +100,7 @@ class FetchOEmbedService end def validate(oembed) - oembed if oembed[:version] == '1.0' && oembed[:type].present? + oembed if oembed[:version].to_s == '1.0' && oembed[:type].present? end def html |