diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-10-28 15:05:07 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2024-01-09 10:56:14 +0100 |
commit | 82b5a19a35b780bf18ebac46711166158a5a6cb2 (patch) | |
tree | bbc44ee4e65f4b7c2f480962f15a9aeb0ca9587f /apps/files_sharing/js | |
parent | 7b6a650b6e09b07d4b85a4ae84eb64a6c32b217f (diff) | |
download | nextcloud-server-82b5a19a35b780bf18ebac46711166158a5a6cb2.tar.gz nextcloud-server-82b5a19a35b780bf18ebac46711166158a5a6cb2.zip |
fix: public dav and files_sharing testing fixes
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r-- | apps/files_sharing/js/files_drop.js | 13 | ||||
-rw-r--r-- | apps/files_sharing/js/public.js | 10 |
2 files changed, 7 insertions, 16 deletions
diff --git a/apps/files_sharing/js/files_drop.js b/apps/files_sharing/js/files_drop.js index ffbe8284433..5215cfc5b54 100644 --- a/apps/files_sharing/js/files_drop.js +++ b/apps/files_sharing/js/files_drop.js @@ -24,10 +24,9 @@ var filesClient = new OC.Files.Client({ host: OC.getHost(), port: OC.getPort(), - userName: $('#sharingToken').val(), // note: password not be required, the endpoint // will recognize previous validation from the session - root: OC.getRootPath() + '/public.php/webdav', + root: OC.getRootPath() + '/public.php/dav/files/' + $('#sharingToken').val() + '/', useHTTPS: OC.getProtocol() === 'https' }); @@ -45,7 +44,7 @@ return false; } var base = OC.getProtocol() + '://' + OC.getHost(); - data.url = base + OC.getRootPath() + '/public.php/webdav/' + encodeURI(name); + data.url = base + OC.getRootPath() + '/public.php/dav/files/' + $('#sharingToken').val() + '/' + encodeURI(name); data.multipart = false; @@ -53,14 +52,6 @@ data.headers = {}; } - var userName = filesClient.getUserName(); - var password = filesClient.getPassword(); - if (userName) { - // copy username/password from DAV client - data.headers['Authorization'] = - 'Basic ' + btoa(userName + ':' + (password || '')); - } - $('#drop-upload-done-indicator').addClass('hidden'); $('#drop-upload-progress-indicator').removeClass('hidden'); diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 154b970c5be..d26cecd02ee 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -69,10 +69,9 @@ OCA.Sharing.PublicApp = { var filesClient = new OC.Files.Client({ host: OC.getHost(), port: OC.getPort(), - userName: token, // note: password not be required, the endpoint // will recognize previous validation from the session - root: OC.getRootPath() + '/public.php/webdav', + root: OC.getRootPath() + '/public.php/dav/files/' + token + '/', useHTTPS: OC.getProtocol() === 'https' }); @@ -167,11 +166,10 @@ OCA.Sharing.PublicApp = { return; } // Undocumented Url to public WebDAV endpoint - var url = parent.location.protocol + '//' + location.host + OC.linkTo('', 'public.php/webdav'); + var url = parent.location.protocol + '//' + location.host + OC.linkTo('', 'public.php/dav/files/'+ token); $.ajax({ url: url, headers: { - Authorization: 'Basic ' + btoa(token + ':'), Range: 'bytes=0-10000' } }).then(function (data) { @@ -247,7 +245,9 @@ OCA.Sharing.PublicApp = { // also add auth in URL due to POST workaround base = OC.getProtocol() + '://' + token + '@' + OC.getHost() + (OC.getPort() ? ':' + OC.getPort() : ''); } - return base + OC.getRootPath() + '/public.php/webdav' + encodedPath; + + // encodedPath starts with a leading slash + return base + OC.getRootPath() + '/public.php/dav/files/' + token + encodedPath; }; this.fileList.getAjaxUrl = function (action, params) { |