From f2d0995362ccdae88ba64597ea6f0feca3eab618 Mon Sep 17 00:00:00 2001 From: Thanh Dodeur Date: Thu, 4 Apr 2019 09:24:34 +0000 Subject: [FIX] mail: fixes document viewer's url preview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- addons/mail/static/src/js/document_viewer.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'addons/mail/static/src/js/document_viewer.js') 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('/'); -- cgit v1.2.3