forked from cybrespace/mastodon
Fix XML oEmbed support discovery (#6104)
This commit is contained in:
parent
127bfda521
commit
e0ef7f9d79
|
@ -29,7 +29,7 @@ class ProviderDiscovery < OEmbed::ProviderDiscovery
|
||||||
end
|
end
|
||||||
|
|
||||||
if format.nil? || format == :xml
|
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
|
format ||= :xml if provider_endpoint
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<!--
|
||||||
|
oEmbed
|
||||||
|
https://oembed.com/
|
||||||
|
> The type attribute must contain either application/json+oembed for JSON
|
||||||
|
> responses, or text/xml+oembed for XML.
|
||||||
|
-->
|
||||||
<link href='https://host/provider.json' rel='alternate' type='application/json+oembed'>
|
<link href='https://host/provider.json' rel='alternate' type='application/json+oembed'>
|
||||||
<link href='https://host/provider.xml' rel='alternate' type='application/xml+oembed'>
|
<link href='https://host/provider.xml' rel='alternate' type='text/xml+oembed'>
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body></body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link href='https://host/provider.xml' rel='alternate' type='application/xml+oembed'>
|
<!--
|
||||||
|
oEmbed
|
||||||
|
https://oembed.com/
|
||||||
|
> The type attribute must contain either application/json+oembed for JSON
|
||||||
|
> responses, or text/xml+oembed for XML.
|
||||||
|
-->
|
||||||
|
<link href='https://host/provider.xml' rel='alternate' type='text/xml+oembed'>
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body></body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue