a5df9781bef443d1e32ae385e4977307aeb7bc50
Steps to reproduce: - Add an image on the website. - Save. - With the HTML editor, change the src of the image (to "https://odoo.com/logo.png" for example) and remove the `mimetypeBeforeConversion` data attribute of the image. Note that it is important to change the src of the image to ensure that the system does not add the `mimetypeBeforeConversion` data attribute back on the image. - Enter in edit mode and click on the image. -> Traceback of type "Cannot read properties of undefined (reading 'split')". This traceback appears because the `_renderCustomXML()` method of `ImageHandlerOption` relies on the presence of formats on the list returned by the `_computeAvailableFormats()` method. Since [1], if there is no `mimetypeBeforeConversion` data attribute on the image, one of the format in the list is `undefined`. As `_renderCustomXML()` tries to perform a `split()` on this format, a traceback appears. Although the steps to reproduce the result seem tricky, it has been decided to create a fix for this situation. Indeed, in version prior to 16.4, the equivalent steps to reproduce (in which the `mimetype` data attribute is removed instead of the `mimetypeBeforeConversion`) do not lead to a traceback. In those versions, if there is no mimetype on the image, the options such as "Filter", "Width" and "Quality" are not shown in the editor panel. The goal of this commit is to apply the same logic for the version 16.4; hide the "Format" option if the image does not have the `mimetypeBeforeConversion` data attribute. To do so, the `_computeWidgetVisibility()` method has been adapted consequently. To avoid the traceback, the `_computeAvailableFormats()` method has been adapted. It now returns an empty list if the image does not have the `mimetypeBeforeConversion` data attribute. As there is no `undefined` format in the returned list of valid formats, the traceback is avoided. [1]: https://github.com/odoo/odoo/commit/730588b802506844e6ca54df312333bfd8df1d52 task-3631487 closes odoo/odoo#148882 X-original-commit: 485a5d74198668fa2f2240b4e31a871f36225857 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
…
…
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%