diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-01-24 13:32:31 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-01-24 13:38:39 +0100 |
commit | c6695bbd764be9f43067c09894e36422c2b92b49 (patch) | |
tree | 0d1ad131a1c7f0ff4dd0aa8df09e0f47f4ea93d8 /apps/files/js/fileactions.js | |
parent | 0671c58e361f2ccf2cd23d73a9712c1a31e838ce (diff) | |
download | nextcloud-server-c6695bbd764be9f43067c09894e36422c2b92b49.tar.gz nextcloud-server-c6695bbd764be9f43067c09894e36422c2b92b49.zip |
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
Diffstat (limited to 'apps/files/js/fileactions.js')
-rw-r--r-- | apps/files/js/fileactions.js | 5 |
1 files changed, 4 insertions, 1 deletions
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 () { |