[Pkg-owncloud-commits] [owncloud] 384/394: let public link download handle json encoded file lists

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:12:56 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 58ef8faacdec8faf3fd5d2d8f4ad0d99e1d738a3
Author: Björn Schießle <schiessle at owncloud.com>
Date:   Wed Mar 13 11:24:29 2013 +0100

    let public link download handle json encoded file lists
---
 apps/files/js/files.js        |    2 +-
 apps/files_sharing/public.php |    8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 0850365..950ba0a 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -205,7 +205,7 @@ $(document).ready(function() {
 		$('#notification').fadeIn();
 		// 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 f4fd6ce..80599b0 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -178,7 +178,13 @@ if ($linkItem) {
 	if (isset($_GET['download'])) {
 		if (isset($_GET['path']) && $_GET['path'] !== '' ) {
 			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 if (isset($_GET['path']) && $_GET['path'] != '' ) { // download a file from a shared directory
 				OC_Files::get($dir, $file, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
 			} else { // download the whole shared directory

-- 
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