diff --git a/packages/web-app-files/src/components/AppBar/AppBar.vue b/packages/web-app-files/src/components/AppBar/AppBar.vue index 4bfde144303..8389c0eedd9 100644 --- a/packages/web-app-files/src/components/AppBar/AppBar.vue +++ b/packages/web-app-files/src/components/AppBar/AppBar.vue @@ -535,8 +535,16 @@ export default { const path = pathUtil.join(this.currentPath, fileName) const url = '/app/new?filename=' + path const headers = new Headers() - headers.append('Authorization', 'Bearer ' + this.getToken) - headers.append('X-Requested-With', 'XMLHttpRequest') + if (!this.isPublicFilesRoute) { + headers.append('Authorization', 'Bearer ' + this.getToken) + headers.append('X-Requested-With', 'XMLHttpRequest') + } else { + headers.append( + 'Authorization', + 'Basic ' + Buffer.from('public:' + this.publicLinkPassword).toString('base64') + ) + } + const response = await fetch(encodeURI(url), { method: 'POST', headers @@ -556,7 +564,7 @@ export default { resource = await this.$client.publicFiles.getFileInfo( path, this.publicLinkPassword, - DavProperties.Default + DavProperties.publicLink ) } resource = buildResource(resource) @@ -576,7 +584,6 @@ export default { } catch (error) { this.showMessage({ title: this.$gettext('Creating file failed…'), - desc: error, status: 'danger' }) }