WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#10538 closed defect (bug) (invalid)

XMLRPC: File Upload missing Base64 Decode

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

Description

I was using the upload XML RPC function to mass import images from a previous blog and found that all the files uploaded were being stored incorrectly. Looking into it, I discovered that although the documentation says that the 'bits' argument is a base64 value (http://codex.wordpress.org/XML-RPC_wp#wp.uploadFile) but that the mw_newMediaObject() function does not decode the 'bits' value. I've attached a diff that I've produced against the 2.8.3 version of xmlrpc.php.

Attachments (1)

xmlrpc.php.diff (87 bytes) - added by amatheson 5 years ago.
Diff of xmlrpc.php (v2.8.3)

Download all attachments as: .zip

Change History (5)

amatheson5 years ago

Diff of xmlrpc.php (v2.8.3)

comment:1 amatheson5 years ago

  • Cc amatheson@… added
  • Component changed from General to XML-RPC
  • Owner set to josephscott

comment:2 redsweater5 years ago

amatheson: I suspect you're not wrapping the base64 data in a <base64> tag as required. The decoding happens at a lower level than xmlrp.php. You have to wrap the bits data in <base64>

This came up recently in an almost identical bug. I guess the documentation could make a point of underlining this base64 tag requirement.

Daniel

comment:3 josephscott5 years ago

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

Exactly what redsweater said. Go back and make sure that you specify that the data in the bits field is using the <base64> tag. The library that WordPress uses for XML-RPC takes care of decoding base64 fields automatically.

I'm closing this ticket as invalid. If you do find that there is a problem we can always come back and open this up again.

comment:4 Denis-de-Bernardy4 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.