diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-03-11 17:13:06 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-03-11 17:13:06 +0100 |
commit | 02b46e990b96ecdfa9183018ce7bf2c6effa18cb (patch) | |
tree | 3925114db4a3958cdb94844d74bea8a39d66a39a | |
parent | edf7162762fc425df1ec2ce7149c18a0af82a3b8 (diff) | |
download | nextcloud-server-02b46e990b96ecdfa9183018ce7bf2c6effa18cb.tar.gz nextcloud-server-02b46e990b96ecdfa9183018ce7bf2c6effa18cb.zip |
json encode download list
-rw-r--r-- | apps/files/ajax/download.php | 9 | ||||
-rw-r--r-- | apps/files/js/files.js | 5 | ||||
-rw-r--r-- | lib/files.php | 8 |
3 files changed, 12 insertions, 10 deletions
diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php index c58c536d77b..7c8dcb372e2 100644 --- a/apps/files/ajax/download.php +++ b/apps/files/ajax/download.php @@ -33,9 +33,10 @@ OCP\User::checkLoggedIn(); $files = $_GET["files"]; $dir = $_GET["dir"]; -if ($files == "Shared" and $dir == "/") { - $files = ''; - $dir = "/Shared"; +$files_list = json_decode($files); +// in case we get only a single file +if ($files_list === NULL ) { + $files_list = array($files); } -OC_Files::get($dir, $files, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); +OC_Files::get($dir, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index f30f21f6497..0850365ec7e 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -198,7 +198,8 @@ $(document).ready(function() { }); $('.download').click('click',function(event) { - var files=getSelectedFiles('name').join(';'); + var files=getSelectedFiles('name'); + var fileslist = JSON.stringify(files); var dir=$('#dir').val()||'/'; $('#notification').text(t('files','generating ZIP-file, it may take some time.')); $('#notification').fadeIn(); @@ -206,7 +207,7 @@ $(document).ready(function() { if ( (downloadURL = document.getElementById("downloadURL")) ) { window.location=downloadURL.value+"&download&files="+files; } else { - window.location=OC.filePath('files', 'ajax', 'download.php') + '?'+ $.param({ dir: dir, files: files }); + window.location=OC.filePath('files', 'ajax', 'download.php') + '?'+ $.param({ dir: dir, files: fileslist }); } return false; }); diff --git a/lib/files.php b/lib/files.php index 41d22610cb9..568aaa39b59 100644 --- a/lib/files.php +++ b/lib/files.php @@ -136,14 +136,14 @@ class OC_Files { * return the content of a file or return a zip file containning multiply files * * @param dir $dir - * @param file $file ; seperated list of files to download + * @param file $file array of files * @param boolean $only_header ; boolean to only send header of the request */ public static function get($dir,$files, $only_header = false) { - if(strpos($files,';')) { - $files=explode(';',$files); + if (count($files) == 1) { + $files = $files[0]; } - + if(is_array($files)) { self::validateZipDownload($dir,$files); $executionTime = intval(ini_get('max_execution_time')); |