diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js index 38db3565971..aa4467a5ee4 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js @@ -658,7 +658,7 @@ var FileWidget = SearchableMediaWidget.extend({ * @private */ _onURLInputChange: function () { - var inputValue = this.$urlInput.val(); + const inputValue = this.$urlInput.val().split('?')[0]; var emptyValue = (inputValue === ''); var isURL = /^.+\..+$/.test(inputValue); // TODO improve diff --git a/odoo/addons/base/models/ir_attachment.py b/odoo/addons/base/models/ir_attachment.py index f87da94153d..4feb3e43f0a 100644 --- a/odoo/addons/base/models/ir_attachment.py +++ b/odoo/addons/base/models/ir_attachment.py @@ -283,7 +283,7 @@ class IrAttachment(models.Model): if not mimetype and values.get('name'): mimetype = mimetypes.guess_type(values['name'])[0] if not mimetype and values.get('url'): - mimetype = mimetypes.guess_type(values['url'])[0] + mimetype = mimetypes.guess_type(values['url'].split('?')[0])[0] if not mimetype or mimetype == 'application/octet-stream': raw = None if values.get('raw'):