From f9e1d4d56e4fa82151ff1681e7de0837970d6cc6 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 7 Mar 2016 11:37:49 +0100 Subject: [PATCH 1/2] Fix archive file name when downloading public share When download a public link share folder using the button on the top right, it doesn't provide a list of files. This fix makes sure to trigger the correct logic when no file list was given. --- apps/files_sharing/lib/controllers/sharecontroller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php index 84143d85e47..ea024b6016a 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -479,7 +479,7 @@ class ShareController extends Controller { $this->emitAccessShareHook($share); // download selected files - if (!is_null($files)) { + if (!is_null($files) && $files !== '') { // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well // after dispatching the request which results in a "Cannot modify header information" notice. OC_Files::get($originalSharePath, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD'); From ebfc8b67d79b05bd93d38a9a7a06e98f0d304830 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 7 Mar 2016 11:55:55 +0100 Subject: [PATCH 2/2] Remove "files" arg from download URL in public link page When no files were specified for download, it means folder download. In this case, no need to pass an empty "files" argument. --- apps/files_sharing/js/public.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index da83044714e..70d5d619c12 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -158,9 +158,11 @@ OCA.Sharing.PublicApp = { filename = JSON.stringify(filename); } var params = { - path: path, - files: filename + path: path }; + if (filename) { + params.files = filename; + } return OC.generateUrl('/s/' + token + '/download') + '?' + OC.buildQueryString(params); };