diff options
| author | Thanh Dodeur <tso@odoo.com> | 2019-04-04 09:24:34 +0000 |
|---|---|---|
| committer | Thanh Dodeur <tso@odoo.com> | 2019-04-04 10:35:54 +0000 |
| commit | f2d0995362ccdae88ba64597ea6f0feca3eab618 (patch) | |
| tree | c87a5d350f6513ad7bd4832dbaf73dcef3b70069 /addons/mail/static/src/js/document_viewer.js | |
| parent | d29e8cf4235f13a0f81baf3694481b0418584ece (diff) | |
[FIX] mail: fixes document viewer's url preview
This commit fixes the document viewer: the document viewer
was altering the `type` key of attachment objects, this issue was causing
matching errors in some cases.
With this commit, the document viewer widget uses its own key `attachment.fileType`
to store the information that used to override `attachment.type`
closes odoo/odoo#32414
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/js/document_viewer.js')
| -rw-r--r-- | addons/mail/static/src/js/document_viewer.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/addons/mail/static/src/js/document_viewer.js b/addons/mail/static/src/js/document_viewer.js index 338b5889828..8b6f27b480e 100644 --- a/addons/mail/static/src/js/document_viewer.js +++ b/addons/mail/static/src/js/document_viewer.js @@ -44,11 +44,10 @@ var DocumentViewer = Widget.extend({ this._super.apply(this, arguments); this.attachment = _.filter(attachments, function (attachment) { var match = attachment.type === 'url' ? attachment.url.match("(youtu|.png|.jpg|.gif)") : attachment.mimetype.match("(image|video|application/pdf|text)"); - if (match) { - attachment.type = match[1]; + attachment.fileType = match[1]; if (match[1].match("(.png|.jpg|.gif)")) { - attachment.type = 'image'; + attachment.fileType = 'image'; } if (match[1] === 'youtu') { var youtube_array = attachment.url.split('/'); |
