[wp-trac] [WordPress Trac] #44231: XML oembed discovery is not implemented correctly

WordPress Trac noreply at wordpress.org
Fri May 25 16:38:50 UTC 2018


#44231: XML oembed discovery is not implemented correctly
--------------------------+-----------------------------
 Reporter:  rivalitaet    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Embeds        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When using XML in oembed discovery, WordPress still tries to encode it as
 JSON and fails. It doesn't retry to check if XML would work.

 How to reproduce this:
 - Add a link tag for an XML oembed: this is clearly tagged as
 `text/xml+oembed` and also has the file extension `.xml`: `<link
 rel="alternate" type="text/xml+oembed"
 href="http://example.com/oembed.xml?url=http://example.com/blah">
 - WordPress will now correctly resolve the provider as
 `http://example.com/oembed.xml?url=http://example.com/blah`
 - Wordpress will send a request to:
 `http://example.com/oembed.xml?url=http://example.com/blah&maxwidth=525&maxheight=788&dnt=1&format=json`.
 Note how it adds `format=json` but still uses the `.xml` file extension
 - The provider correctly returns an XML response, with HTTP status code
 200
 - Wordpress tries to parse it as JSON and fails
 - Wordpress doesn't retry with `format=xml` since it only tries XML if the
 JSON endpoint failed with HTTP status code 501


 Background info from the spec:
 - If the format of the request is given in the file extension (e.g.
 `/oembed.xml`), the provider should ignore the `format` parameter. (See
 https://oembed.com/#section2.2).
 - For discovery the provider should specify the full oembed endpoint,
 including the `format` paramter. It's therefore wrong to override it in
 Wordpress. (See https://oembed.com/#section4)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44231>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list