diff options
| author | Jorge Pinna Puissant <jpp@odoo.com> | 2020-06-10 13:12:47 +0000 |
|---|---|---|
| committer | Jorge Pinna Puissant <jpp@odoo.com> | 2020-06-12 06:48:05 +0000 |
| commit | 07a3d7f31e5a77b9ff65c52d0292d7ee4595e5e4 (patch) | |
| tree | 3c5e0478658b17adac54667700d945f2aeb0c1ef /addons/mail/static | |
| parent | 0c67025c40c0d0ac86c19638addc999e4725418f (diff) | |
[FIX] mail: pdfjs viewer download name
Before this commit, when downloading a pdf from the pdfjs viewer, the
name of the pdf was always 'document.pdf'.
Now, the correct name of the pdf is used when downloading the file.
opw-2269841
closes odoo/odoo#52878
X-original-commit: b9cd32a7f19b8f73385dea534ad3cc5b126bc6dd
Related: odoo/enterprise#11109
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Diffstat (limited to 'addons/mail/static')
| -rw-r--r-- | addons/mail/static/src/xml/thread.xml | 2 | ||||
| -rw-r--r-- | addons/mail/static/tests/document_viewer_tests.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/mail/static/src/xml/thread.xml b/addons/mail/static/src/xml/thread.xml index bf1c5427911..05f9f04f6f7 100644 --- a/addons/mail/static/src/xml/thread.xml +++ b/addons/mail/static/src/xml/thread.xml @@ -61,7 +61,7 @@ <t t-set="unique" t-value="widget.activeAttachment.checksum ? widget.activeAttachment.checksum.slice(-8) : ''"/> <img class="o_viewer_img" t-attf-src="/web/image/#{widget.activeAttachment.id}?unique=#{unique}&model=#{model}" alt="Viewer"/> </t> - <iframe t-if="widget.activeAttachment.fileType == 'application/pdf'" class="mt32 o_viewer_pdf" t-attf-src="/web/static/lib/pdfjs/web/viewer.html?file=/web/content/#{widget.activeAttachment.id}?model%3D#{model}" /> + <iframe t-if="widget.activeAttachment.fileType == 'application/pdf'" class="mt32 o_viewer_pdf" t-attf-src="/web/static/lib/pdfjs/web/viewer.html?file=/web/content/#{widget.activeAttachment.id}?model%3D#{model}%26filename%3D#{window.encodeURIComponent(widget.activeAttachment.name)}" /> <iframe t-if="(widget.activeAttachment.fileType || '').indexOf('text') !== -1" class="mt32 o_viewer_text" t-attf-src="/web/content/#{widget.activeAttachment.id}?model=#{model}" /> <iframe t-if="widget.activeAttachment.fileType == 'youtu'" class="mt32 o_viewer_text" allow="autoplay; encrypted-media" width="560" height="315" t-attf-src="https://www.youtube.com/embed/#{widget.activeAttachment.youtube}"/> <video t-if="widget.activeAttachment.fileType == 'video'" class="o_viewer_video" controls="controls"> diff --git a/addons/mail/static/tests/document_viewer_tests.js b/addons/mail/static/tests/document_viewer_tests.js index 5ccb9df5ff3..aa50483b48a 100644 --- a/addons/mail/static/tests/document_viewer_tests.js +++ b/addons/mail/static/tests/document_viewer_tests.js @@ -19,7 +19,7 @@ var createViewer = function (params) { var viewer = new DocumentViewer(parent, params.attachments, params.attachmentID); var mockRPC = function (route) { - if (route === '/web/static/lib/pdfjs/web/viewer.html?file=/web/content/1?model%3Dir.attachment') { + if (route === '/web/static/lib/pdfjs/web/viewer.html?file=/web/content/1?model%3Dir.attachment%26filename%3DfilePdf.pdf') { return Promise.resolve(); } if (route === 'https://www.youtube.com/embed/FYqW0Gdwbzk') { |
