Sunday, February 25, 2024
1 change · saas-17.1
Resolved issues and error corrections
This update prevents a crash in the image editor when a website image URL is invalid (404). The fix utilizes a placeholder image to ensure the editor continues to function correctly, improving the user experience. A related issue has been identified and addressed to prevent future occurrences.
Original PR description
Commit [1] introduced some code that relied on a cache we currently have for processed** images. In case of 404, that cache is not filled... and relying on it thus crashes. This commit circles around…
Commit [1] introduced some code that relied on a cache we currently have for processed** images. In case of 404, that cache is not filled... and relying on it thus crashes. This commit circles around the issue by taking profit of [2] which now forces `loadImage` to load a placeholder image in case of a 404. This makes sure that in case of a 404 during the initial call to `loadImage`, the rest of the stack works with the loaded placeholder image. **Note: the current cache is not filled at the `loadImage` level, but later when processing the fetched image. This should be changed in the future (a task has been created). See [3] and [4] which are example of unwanted 404 images due to other issues, which allowed to discover this bug to fix here. Steps to reproduce: - Go on the `website.s_picture_default_image` ir.attachment form view - Change the URL value to a relative path that does not exist - Go on a website page and edit - Drop the "Picture" snippet => Crash => After this fix, no crash but you can also edit the image if you were able to click on it, it would use the placeholder image as source. [1]: https://github.com/odoo/odoo/commit/567e5b58d544e4e56c3a68d148e862a516d77c4f [2]: https://github.com/odoo/odoo/commit/0639c5028c69d8e29c8438b741cc4713d875b06d [3]: https://github.com/odoo/odoo/pull/155015 [4]: https://github.com/odoo/design-themes/pull/767 Related to opw-3693055 and others (see [3] and [4]). Forward-Port-Of: odoo/odoo#155275 Forward-Port-Of: odoo/odoo#155097