diff options
| author | xO-Tx <mou@odoo.com> | 2020-09-21 13:36:26 +0000 |
|---|---|---|
| committer | xO-Tx <mou@odoo.com> | 2020-10-06 15:57:20 +0000 |
| commit | ecffbe4060eea98d3444f308bcd28bfb9287e1c3 (patch) | |
| tree | 6a751ad19321630832306f91de8e429b1e23d3f8 /addons | |
| parent | 44055fd0f0de4f4a64635bd384c6004eb67c8374 (diff) | |
[FIX] web_editor: fix empty media dialog save issue
when media dialog launched for the first time (with no selected
media attachment), "FileWidget.selectedAttachments" contains a default
object {url:... , alt:...} (default attachment already on the target),
and the click on "Add" button will cause a backtrace since the code on
"_save" method tries to access "image_src" attribute on all selectedAttachments
elements including default one.
The simplest solution would be to check if the object already has
an "image_src" attribute.
task-2312878
closes odoo/odoo#58143
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/web_editor/static/src/js/wysiwyg/widgets/media.js | 2 |
1 files changed, 1 insertions, 1 deletions
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 3134f55b373..65bceb1b053 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js @@ -396,7 +396,7 @@ var FileWidget = SearchableMediaWidget.extend({ } const selected = this.selectedAttachments.concat(mediaAttachments).map(attachment => { // Color-customize dynamic SVGs with the primary theme color - if (attachment.image_src.startsWith('/web_editor/shape/')) { + if (attachment.image_src && attachment.image_src.startsWith('/web_editor/shape/')) { const colorCustomizedURL = new URL(attachment.image_src, window.location.origin); colorCustomizedURL.searchParams.set('c1', getCSSVariableValue('o-color-1')); attachment.image_src = colorCustomizedURL.pathname + colorCustomizedURL.search; |
