diff options
Diffstat (limited to 'apps/files_sharing/js/public.js')
-rw-r--r-- | apps/files_sharing/js/public.js | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index c1b7eee3fb7..06c168969de 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -1,3 +1,15 @@ +/* + * Copyright (c) 2014 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + +/* global OC, FileList, FileActions */ + // Override download path to files_sharing/public.php function fileDownloadPath(dir, file) { var url = $('#downloadURL').val(); @@ -28,12 +40,20 @@ $(document).ready(function() { // override since the format is different FileList.getDownloadUrl = function(filename, dir) { - // we use this because we need the service and token attributes - var tr = FileList.findFileEl(filename); - if (tr.length > 0) { - return $(tr).find('a.name').attr('href') + '&download'; + if ($.isArray(filename)) { + filename = JSON.stringify(filename); + } + var path = dir || FileList.getCurrentDirectory(); + var params = { + service: 'files', + t: $('#sharingToken').val(), + path: path, + download: null + }; + if (filename) { + params.files = filename; } - return null; + return OC.filePath('', '', 'public.php') + '?' + OC.buildQueryString(params); }; } |