[Pkg-owncloud-commits] [owncloud] 380/394: json encode download list

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:12:55 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit 02b46e990b96ecdfa9183018ce7bf2c6effa18cb
Author: Björn Schießle <schiessle at owncloud.com>
Date:   Mon Mar 11 17:13:06 2013 +0100

    json encode download list
---
 apps/files/ajax/download.php |    9 +++++----
 apps/files/js/files.js       |    5 +++--
 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 c58c536..7c8dcb3 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 f30f21f..0850365 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 41d2261..568aaa3 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'));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list