From fc115ebdf7c3783f9eaabba71eccce23c676d957 Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Fri, 3 Jun 2022 14:24:02 +0000 Subject: [PATCH] [FIX] web: invalid image placeholder resizing Access `/web/image/82303?height=16`, traceback because the placeholder image cannot be resized to `"16"`. closes odoo/odoo#92891 Signed-off-by: Julien Castiaux --- addons/mail/controllers/discuss.py | 2 +- addons/web/controllers/binary.py | 2 +- addons/website_slides/controllers/main.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/controllers/discuss.py b/addons/mail/controllers/discuss.py index 85a09d93910..24f6b85b4f2 100644 --- a/addons/mail/controllers/discuss.py +++ b/addons/mail/controllers/discuss.py @@ -183,7 +183,7 @@ class DiscussController(http.Controller): raise NotFound() return request.env['ir.binary']._get_image_stream_from( - attachment_sudo, width=width, height=height + attachment_sudo, width=int(width), height=int(height) ).get_response(as_attachment=kwargs.get('download')) # -------------------------------------------------------------------------- diff --git a/addons/web/controllers/binary.py b/addons/web/controllers/binary.py index b547d55110f..2b2cfb2095e 100644 --- a/addons/web/controllers/binary.py +++ b/addons/web/controllers/binary.py @@ -142,7 +142,7 @@ class Binary(http.Controller): width, height = image_guess_size_from_field_name(field) record = request.env.ref('web.image_placeholder').sudo() stream = request.env['ir.binary']._get_image_stream_from( - record, 'raw', width=width, height=height, crop=crop, + record, 'raw', width=int(width), height=int(height), crop=crop, ) send_file_kwargs = {'as_attachment': download} diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py index 279337ac379..1ab6fb563fa 100644 --- a/addons/website_slides/controllers/main.py +++ b/addons/website_slides/controllers/main.py @@ -820,7 +820,7 @@ class WebsiteSlides(WebsiteProfile): raise werkzeug.exceptions.NotFound() return request.env['ir.binary']._get_image_stream_from( - slide, field, width=width, height=int(height), crop=int(crop) + slide, field, width=int(width), height=int(height), crop=int(crop) ).get_response() # SLIDE.SLIDE UTILS