diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-11-23 16:17:54 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-11-25 17:39:49 +0100 |
commit | 42091cecf9f96d8aa3fc5c2b5bda9156bae459b5 (patch) | |
tree | 55e04af47085ddd4372053c74982c07d71e27efa /apps/files_sharing/js/public.js | |
parent | a1c4e2e635100ce4d8d7b5cba25eff8a9a62f972 (diff) | |
download | nextcloud-server-42091cecf9f96d8aa3fc5c2b5bda9156bae459b5.tar.gz nextcloud-server-42091cecf9f96d8aa3fc5c2b5bda9156bae459b5.zip |
Fix public link getDownloadUrl to return Webdav public link
This is for apps that use getDownloadUrl() to access the Webdav endpoint
for example for streaming.
Also happens when clicking on the download action of a file.
Note that the regular visible download URL is still the same.
Diffstat (limited to 'apps/files_sharing/js/public.js')
-rw-r--r-- | apps/files_sharing/js/public.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 82691129926..16576651a25 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -148,11 +148,14 @@ OCA.Sharing.PublicApp = { if (this.fileList) { // TODO: move this to a separate PublicFileList class that extends OCA.Files.FileList (+ unit tests) - this.fileList.getDownloadUrl = function (filename, dir) { - if ($.isArray(filename)) { + this.fileList.getDownloadUrl = function (filename, dir, isDir) { + var path = dir || this.getCurrentDirectory(); + if (filename && !_.isArray(filename) && !isDir) { + return OC.getRootPath() + '/public.php/webdav' + OC.joinPaths(path, filename); + } + if (_.isArray(filename)) { filename = JSON.stringify(filename); } - var path = dir || FileList.getCurrentDirectory(); var params = { path: path, files: filename |