]> source.dussan.org Git - nextcloud-server.git/commitdiff
let public link download handle json encoded file lists
authorBjörn Schießle <schiessle@owncloud.com>
Wed, 13 Mar 2013 10:40:46 +0000 (11:40 +0100)
committerBjörn Schießle <schiessle@owncloud.com>
Wed, 13 Mar 2013 10:40:46 +0000 (11:40 +0100)
apps/files/js/files.js
apps/files_sharing/public.php

index a4ef41c280382cdf34925504d416ea0ea39777eb..82069e3bc578b20827879e5a40dc1ba60edaa456 100644 (file)
@@ -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 });
                }
index 1da972ad7e3fd295053a4b419de74cb1bdf2c501..c8aca498f8c573affb7c7d6389178dea2110cf5b 100644 (file)
@@ -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);
                }