diff options
author | blizzz <blizzz@owncloud.com> | 2015-11-18 22:48:35 +0100 |
---|---|---|
committer | blizzz <blizzz@owncloud.com> | 2015-11-18 22:48:35 +0100 |
commit | 5d2e1268cd72d2a2a44136a298a675f8fe72d93d (patch) | |
tree | c596e7664b4f6d0ff7b85fabdb8583cb1258da6b /apps/files_sharing/js/public.js | |
parent | da5285dc23dc88d8f570409a8d7ed1296b95f407 (diff) | |
download | nextcloud-server-5d2e1268cd72d2a2a44136a298a675f8fe72d93d.tar.gz nextcloud-server-5d2e1268cd72d2a2a44136a298a675f8fe72d93d.zip |
Avoid double slashes in URL when trying to add an remote share
When being on a link share and clicking "Add to your ownCloud" a double slash might be inserted in the URL if the entered ownCloud host ended with a slash. Results in a server error.
Diffstat (limited to 'apps/files_sharing/js/public.js')
-rw-r--r-- | apps/files_sharing/js/public.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 246b639f652..b3098f9dcdc 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -274,8 +274,12 @@ OCA.Sharing.PublicApp = { _saveToOwnCloud: function (remote, token, owner, name, isProtected) { var location = window.location.protocol + '//' + window.location.host + OC.webroot; + + if(remote.substr(-1) !== '/') { + remote += '/' + }; - var url = remote + '/index.php/apps/files#' + 'remote=' + encodeURIComponent(location) // our location is the remote for the other server + var url = remote + 'index.php/apps/files#' + 'remote=' + encodeURIComponent(location) // our location is the remote for the other server + "&token=" + encodeURIComponent(token) + "&owner=" + encodeURIComponent(owner) + "&name=" + encodeURIComponent(name) + "&protected=" + isProtected; |