From b8aca9dc5b8a52c1b8d49304425dd4614470a277 Mon Sep 17 00:00:00 2001 From: "Walid HANNICHE (waha)" Date: Mon, 29 Aug 2022 16:41:21 +0000 Subject: [PATCH] [FIX] website: prevent favicon removal to crash Before this commit, when one would remove the favicon of a website in the settings it would crash. This is because since [1] the introduction of `base64.b64encode()` in the `_handle_favicon()` method make it crash with `False` value. Steps to reproduce: - Settings > website - Delete favicon [1]: https://github.com/odoo/odoo/commit/6b8752604898bf2b583b7f5334e35f6a1583595e opw-2958836 closes odoo/odoo#100399 X-original-commit: 35ce152d7e5c50cb363c0fa7adecf174fede9e46 Signed-off-by: Romain Derie (rde) --- addons/website/models/website.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 61ef236875a..56d7c800a8d 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -267,7 +267,7 @@ class Website(models.Model): @api.model def _handle_favicon(self, vals): - if 'favicon' in vals: + if vals.get('favicon'): vals['favicon'] = base64.b64encode(tools.image_process(base64.b64decode(vals['favicon']), size=(256, 256), crop='center', output_format='ICO')) @api.model