summaryrefslogtreecommitdiff
path: root/lib/exe/xmlrpc.php
diff options
context:
space:
mode:
authorAdrian Lang <mail@adrianlang.de>2011-10-30 11:02:44 +0100
committerAdrian Lang <mail@adrianlang.de>2011-10-30 11:03:38 +0100
commit80d6fbc300b7e423fe0d2373cf3888c80ac94a41 (patch)
treededf7da2639b48037a18a297b936c92fdceb182c /lib/exe/xmlrpc.php
parent3629bc8cec45352566fcad4764203908c2b22528 (diff)
downloadrpg-80d6fbc300b7e423fe0d2373cf3888c80ac94a41.tar.gz
rpg-80d6fbc300b7e423fe0d2373cf3888c80ac94a41.tar.bz2
Fix double-decoding in XMLRPC putAttachment
Diffstat (limited to 'lib/exe/xmlrpc.php')
-rw-r--r--lib/exe/xmlrpc.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index 8e4141d4e..e5e3298ae 100644
--- a/lib/exe/xmlrpc.php
+++ b/lib/exe/xmlrpc.php
@@ -7,7 +7,7 @@ if(isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
/**
* Increased whenever the API is changed
*/
-define('DOKU_XMLRPC_API_VERSION',5);
+define('DOKU_XMLRPC_API_VERSION', 6);
require_once(DOKU_INC.'inc/init.php');
session_write_close(); //close session
@@ -584,8 +584,12 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
// save temporary file
@unlink($ftmp);
- $buff = base64_decode($file);
- io_saveFile($ftmp, $buff);
+ if (preg_match('/^[A-Za-z0-9\+\/]*={0,2}$/', $file) === 1) {
+ // DEPRECATED: Double-decode file if it still looks like base64
+ // after first decoding (which is done by the library)
+ $file = base64_decode($file);
+ }
+ io_saveFile($ftmp, $file);
$res = media_save(array('name' => $ftmp), $id, $params['ow'], $auth, 'rename');
if (is_array($res)) {