[FIX] web_editor: restore shape on default images in themes
Website themes make customizations to the default snippets. In particular, some are applying shapes on default images. To do that, the customization is not applied on the image directly but by changing its src to a special web_editor route in charge of automatically adding the shape on whatever default image the configurator chose for this snippet. Typically, in a snippet with an image whose src is: /web/image/website.my_snippet_default_image The src is replaced by the theme with: /web_editor/image_shape/website.my_snippet_default_image/website/some_shape.svg That controller/route crashed since [1], making those images blank areas in pages generated by the configurator. Indeed, the image from the filestore was accessed via `file_open` which only allows reading inside the addons_paths. [1]: https://github.com/odoo/odoo/commit/da8def8e410de68256ba4ab09ebf7a8b699355ac closes odoo/odoo#105421 X-original-commit: d536e0a23cf0aa06c3ee13fb2c105e83201434e0 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by: Julien Castiaux <juc@odoo.com>
This commit is contained in:
co-authored by
Julien Castiaux
parent
246666fe7d
commit
0e8e5d4c0a
@@ -630,12 +630,7 @@ class Web_Editor(http.Controller):
|
||||
if stream.type == 'url':
|
||||
return stream.get_response()
|
||||
|
||||
if stream.type == 'path':
|
||||
with file_open(stream.path, 'rb') as file:
|
||||
image = file.read()
|
||||
else:
|
||||
image = stream.data
|
||||
|
||||
image = stream.read()
|
||||
img = binary_to_image(image)
|
||||
width, height = tuple(str(size) for size in img.size)
|
||||
root = etree.fromstring(svg)
|
||||
|
||||
Reference in New Issue
Block a user