Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-03-26 12:55:40 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2013-03-26 12:55:40 +0400
commite0cf61dfc8810f5f36e829e470a252abe3300e7b (patch)
tree980a7c296bdf53aadb9bb1d712d836d98ef1dc9e
parent2387fbd9ddfcbb992850ae2b61a2ccb26fd52c06 (diff)
parent896c56996effc341a6d9900d3c345843c9c092c5 (diff)
Merge pull request #2272 from owncloud/fix_json_encoded_pubic_download_oc5
let public link download handle json encoded file lists [oc5]
-rw-r--r--apps/files/js/files.js2
-rw-r--r--apps/files_sharing/public.php8
2 files changed, 8 insertions, 2 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index a4ef41c2803..82069e3bc57 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -226,7 +226,7 @@ $(document).ready(function() {
OC.Notification.show(t('files','Your download is being prepared. This might take some time if the files are big.'));
// use special download URL if provided, e.g. for public shared files
if ( (downloadURL = document.getElementById("downloadURL")) ) {
- window.location=downloadURL.value+"&download&files="+files;
+ window.location=downloadURL.value+"&download&files="+encodeURIComponent(fileslist);
} else {
window.location=OC.filePath('files', 'ajax', 'download.php') + '?'+ $.param({ dir: dir, files: fileslist });
}
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 1da972ad7e3..c8aca498f8c 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -113,7 +113,13 @@ if (isset($path)) {
// Download the file
if (isset($_GET['download'])) {
if (isset($_GET['files'])) { // download selected files
- OC_Files::get($path, $_GET['files'], $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
+ $files = urldecode($_GET['files']);
+ $files_list = json_decode($files);
+ // in case we get only a single file
+ if ($files_list === NULL ) {
+ $files_list = array($files);
+ }
+ OC_Files::get($path, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
} else {
OC_Files::get($dir, $file, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
}