While developing an air app that makes use of the xml-rpc interface to dokuwiki, I found out that there is a bug in the interface (http://forum.dokuwiki.org/post/27509). The dokuwiki.putAttachment method, decodes the file twice. When a well-formed request is sent to the interface, the original xml-rpc interface will decode the data to binary code (
https://github.com/splitbrain/dokuwiki/blob/master/inc/IXR_Library.php#L239 ), and then the dokuwiki wrapper will try to decode it again (https://github.com/splitbrain/dokuwiki/blob/master/lib/exe/xmlrpc.php#L587 ), resulting in gibberish. When using the php library for xml-rpc as used by one of the forum moderators, it seems that the interface is correct, but this is only because in that example (http://forum.dokuwiki.org/post/27596), the file was already encoded in base64, and then again encoded by the xml-rpc library (http://phpxmlrpc.cvs.sourceforge.net/viewvc/phpxmlrpc/xmlrpc/xmlrpc.inc?view=markup on line 2929).
Due to this bug in the interface, files are encoded twice, resulting in twice the cpu overhead, and twice the filesize (per encoding pass, base64 apparently adds about 30% extra data).
To fix this, just change line 587 from:
[code]
io_saveFile($ftmp, $buff);
[/code]
to:
[code]
io_saveFile($ftmp, $file);
[/code]
and remove the lines involving $buff.
however, it might be possible to change this so existing software doesn't break, by checking if the first decoded var $file, ends with the '=' character, though this might bug out in certain cases.