diff --git a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js index 04f2b40c091..838ec03cde9 100644 --- a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js +++ b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js @@ -178,7 +178,7 @@ export class AttachmentViewer extends Component { - + `); printWindow.document.close(); diff --git a/addons/mail/static/src/models/attachment.js b/addons/mail/static/src/models/attachment.js index 9ccc5a25bb2..294157fb350 100644 --- a/addons/mail/static/src/models/attachment.js +++ b/addons/mail/static/src/models/attachment.js @@ -49,7 +49,7 @@ registerModel({ */ download() { const downloadLink = document.createElement('a'); - downloadLink.setAttribute('href', `/web/content/ir.attachment/${this.id}/datas?download=true`); + downloadLink.setAttribute('href', this.downloadUrl); // Adding 'download' attribute into a link prevents open a new tab or change the current location of the window. // This avoids interrupting the activity in the page such as rtc call. downloadLink.setAttribute('download', ''); @@ -140,10 +140,10 @@ registerModel({ */ _computeDownloadUrl() { if (!this.accessToken && this.originThread && this.originThread.model === 'mail.channel') { - return `/mail/channel/${this.originThread.id}/attachment/${this.id}`; + return `/mail/channel/${this.originThread.id}/attachment/${this.id}?download=true`; } - const accessToken = this.accessToken ? `?access_token=${this.accessToken}` : ''; - return `/web/content/ir.attachment/${this.id}/datas${accessToken}`; + const accessToken = this.accessToken ? `access_token=${this.accessToken}&` : ''; + return `/web/content/ir.attachment/${this.id}/datas?${accessToken}download=true`; }, /** * @private