Ticket #7772 (closed defect (bug): fixed)

Opened 3 years ago

Last modified 3 years ago

XMLRPC interface doesn't reflect enclosures back as <enclosure> attributes

Reported by: redsweater Owned by: josephscott
Priority: normal Milestone: 2.7
Component: XML-RPC Version:
Severity: normal Keywords:
Cc: redsweater

Description

The new enclosure support in WP 2.6 accepts an enclosure specified as an <enclosure> element on a submitted post, but doesn't advertise the presence of that enclosure as an <enclosure> element on get requests.

Instead, the enclosures are represented as custom field attributes, which is probably fine, but which doesn't provide a valid way for a basic XMLRPC MetaWeblog client to get at the existing enclosure value on a given post.

I am not sure whether only the first enclosure should be exhibited as an <enclosure> element, or whether all of them should be. But the <enclosure> element should be used to convey an existing enclosure item to XMLRPC MetaWeblog clients.

Daniel

Attachments

7772.diff Download (1.0 KB) - added by Otto42 3 years ago.
First attempt at a patch
7772.2.diff Download (1.0 KB) - added by Otto42 3 years ago.
Attempt number two…

Change History

Attached a patch that I think will do the job, but I don't know any easy way to test it. Do you know of a client that works well with enclosures like this?

Otto423 years ago

First attempt at a patch

One question about the patch, what happens if there's more than one enclosure for the post?

comment:3 follow-up: ↓ 4   Otto423 years ago

This patch only gets the first one. Notice the "break 2;" line to stop once it gets one.

Otto423 years ago

Attempt number two...

comment:4 in reply to: ↑ 3   josephscott3 years ago

Replying to Otto42:

This patch only gets the first one. Notice the "break 2;" line to stop once it gets one.

That was my point :-)

Do clients (and the API for that matter) expect there to only ever be one enclosure per post?

I was only going by what the original request in the ticket was. If we want it to have more than one enclosure, then we need to know what clients expect as far as that goes.

Good point, seems like limiting it to one is the right thing to do at this point.

comment:7   ryan3 years ago

  • Status changed from new to closed
  • Resolution set to fixed

(In [9089]) Return enclosure data in mw_getPosts(). Props Otto42. fixes #7772

comment:8   ryan3 years ago

  • Milestone changed from 2.8 to 2.7
Note: See TracTickets for help on using tickets.