summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/public.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-01-24 13:32:31 +0100
committerVincent Petry <pvince81@owncloud.com>2014-01-24 13:38:39 +0100
commitc6695bbd764be9f43067c09894e36422c2b92b49 (patch)
tree0d1ad131a1c7f0ff4dd0aa8df09e0f47f4ea93d8 /apps/files_sharing/js/public.js
parent0671c58e361f2ccf2cd23d73a9712c1a31e838ce (diff)
downloadnextcloud-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_sharing/js/public.js')
-rw-r--r--apps/files_sharing/js/public.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 4c0b0ad9d48..79c15623c0c 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -34,18 +34,16 @@ $(document).ready(function() {
window.location = $(tr).find('a.name').attr('href');
}
});
- FileActions.register('file', 'Download', OC.PERMISSION_READ, '', function(filename) {
- var tr = FileList.findFileEl(filename);
- if (tr.length > 0) {
- window.location = $(tr).find('a.name').attr('href');
- }
- });
- FileActions.register('dir', 'Download', OC.PERMISSION_READ, '', function(filename) {
+
+ // 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) {
- window.location = $(tr).find('a.name').attr('href')+'&download';
+ return $(tr).find('a.name').attr('href') + '&download';
}
- });
+ return null;
+ };
}
var file_upload_start = $('#file_upload_start');