From c6695bbd764be9f43067c09894e36422c2b92b49 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 24 Jan 2014 13:32:31 +0100 Subject: Fixed download URL in public page - Refactored download URL building to make it overridable - Added download URL override in public page - Added JS unit tests for download URL - Added OC.redirect() method to facilitate unit testing --- apps/files/js/fileactions.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apps/files/js/fileactions.js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 74bb711ef3d..eb59e71a030 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -173,7 +173,10 @@ $(document).ready(function () { FileActions.register(downloadScope, 'Download', OC.PERMISSION_READ, function () { return OC.imagePath('core', 'actions/download'); }, function (filename) { - window.location = OC.filePath('files', 'ajax', 'download.php') + '?files=' + encodeURIComponent(filename) + '&dir=' + encodeURIComponent($('#dir').val()); + var url = FileList.getDownloadUrl(filename); + if (url) { + OC.redirect(url); + } }); } $('#fileList tr').each(function () { -- cgit v1.2.3