aboutsummaryrefslogtreecommitdiffstats
path: root/storage-backend/index.php
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-02-05 14:13:19 +0100
committersteckbrief <steckbrief@chefmail.de>2016-02-05 14:13:19 +0100
commit7f77bd308784a55193a3d18bacf079df5494511c (patch)
tree14ac9fe29a989ecd7c539935aedcf827ddf54c9f /storage-backend/index.php
parentc6da13b6320e3bb20f57a24ccb336de2684dd658 (diff)
php end tags added, rawurlencode optimized
Diffstat (limited to '')
-rw-r--r--storage-backend/index.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/storage-backend/index.php b/storage-backend/index.php
index ab59617..5d70b79 100644
--- a/storage-backend/index.php
+++ b/storage-backend/index.php
@@ -44,7 +44,7 @@ switch ($method) {
// parse post parameters
// check if all parameters are present - return 400 (bad request) if a parameter is missing / empty
$xmppServerKey = getMandatoryPostParameter('xmpp_server_key');
- $filename = getMandatoryPostParameter('filename');
+ $filename = rawurlencode(getMandatoryPostParameter('filename'));
$filesize = getMandatoryPostParameter('size');
$type = getOptionalPostParameter('content_type');
$userJid = getMandatoryPostParameter('user_jid');
@@ -128,13 +128,13 @@ function checkXmppServerKey($validXmppServerKeys, $xmppServerKey) {
}
function checkFilenameParameter($filename, $slotParameters) {
- $filename = rawurldecode($filename); // the filename is a http get parameter and therefore encoded
+ $filename = $filename; // the filename is a http get parameter and therefore encoded
return $slotParameters['filename'] == $filename;
}
function loadSlotParameters($slotUUID, $config) {
$slotParameters = require(getSlotFilePath($slotUUID, $config));
- $slotParameters['filename'] = rawurldecode($slotParameters['filename']);
+ $slotParameters['filename'] = $slotParameters['filename'];
return $slotParameters;
}
@@ -180,8 +180,8 @@ function getFilenameFromUri($uri) {
function registerSlot($slotUUID, $filename, $filesize, $contentType, $userJid, $config) {
$contents = "<?php\n/*\n * This is an autogenerated file - do not edit\n */\n\n";
- $contents .= 'return [\'filename\' => \''.rawurlencode($filename).'\', \'filesize\' => \''.$filesize.'\', ';
- $contents .= '\'content_type\' => \''.$contentType.'\', \'user_jid\' => \''.$userJid.'\'];';
+ $contents .= 'return [\'filename\' => \''.$filename.'\', \'filesize\' => \''.$filesize.'\', ';
+ $contents .= '\'content_type\' => \''.$contentType.'\', \'user_jid\' => \''.$userJid.'\'];\n?>';
if (!file_put_contents(getSlotFilePath($slotUUID, $config), $contents)) {
sendHttpReturnCodeAndMessage(500, "Could not create slot registry entry.");
}
@@ -250,3 +250,4 @@ function generate_uuid() {
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
);
}
+?> \ No newline at end of file