From d8a0c1916676fc1fa5e0eb0739a79a8fae9d40d0 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Wed, 27 Dec 2017 11:29:49 +0900 Subject: [PATCH] Fix XML oEmbed support discovery (#6104) --- app/lib/provider_discovery.rb | 2 +- spec/fixtures/requests/oembed_json_xml.html | 8 +++++++- spec/fixtures/requests/oembed_xml.html | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/lib/provider_discovery.rb b/app/lib/provider_discovery.rb index 04ba381010..5732e4fcb4 100644 --- a/app/lib/provider_discovery.rb +++ b/app/lib/provider_discovery.rb @@ -29,7 +29,7 @@ class ProviderDiscovery < OEmbed::ProviderDiscovery end if format.nil? || format == :xml - provider_endpoint ||= html.at_xpath('//link[@type="application/xml+oembed"]')&.attribute('href')&.value + provider_endpoint ||= html.at_xpath('//link[@type="text/xml+oembed"]')&.attribute('href')&.value format ||= :xml if provider_endpoint end diff --git a/spec/fixtures/requests/oembed_json_xml.html b/spec/fixtures/requests/oembed_json_xml.html index b5fc9bed09..8afd8e9972 100644 --- a/spec/fixtures/requests/oembed_json_xml.html +++ b/spec/fixtures/requests/oembed_json_xml.html @@ -1,8 +1,14 @@ + - + diff --git a/spec/fixtures/requests/oembed_xml.html b/spec/fixtures/requests/oembed_xml.html index 5d7633e713..bdfcca1707 100644 --- a/spec/fixtures/requests/oembed_xml.html +++ b/spec/fixtures/requests/oembed_xml.html @@ -1,7 +1,13 @@ - + +