Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elizavetaRa committed Nov 30, 2021
1 parent 339cae0 commit 7ffb77e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/web-app-files/src/components/AppBar/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -556,7 +564,7 @@ export default {
resource = await this.$client.publicFiles.getFileInfo(
path,
this.publicLinkPassword,
DavProperties.Default
DavProperties.publicLink
)
}
resource = buildResource(resource)
Expand All @@ -576,7 +584,6 @@ export default {
} catch (error) {
this.showMessage({
title: this.$gettext('Creating file failed…'),
desc: error,
status: 'danger'
})
}
Expand Down

0 comments on commit 7ffb77e

Please sign in to comment.