From b77bbd01f8f746afb49239abc28a4bd543528917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Tue, 6 Aug 2019 11:53:46 +0000 Subject: [PATCH] [FIX] tools: fix condition of image_process quick return Follow up of 344614b54a2aa7799a551306b31c00f52ed4f999 If base64_source is falsy, we don't need to check the other parameters. closes odoo/odoo#35489 Signed-off-by: Quentin Smetz (qsm) --- odoo/tools/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odoo/tools/image.py b/odoo/tools/image.py index ed1581c05cf..0666dd80d95 100644 --- a/odoo/tools/image.py +++ b/odoo/tools/image.py @@ -80,7 +80,7 @@ class ImageProcess(): :param quality: quality setting to apply. Default to 0. - for JPEG: 1 is worse, 95 is best. Values above 95 should be - avoided. Fasly values will fallback to 95, but only if the image + avoided. Falsy values will fallback to 95, but only if the image was changed, otherwise the original image is returned. - for PNG: set falsy to prevent conversion to a WEB palette. - for other formats: no effect. @@ -245,7 +245,7 @@ def image_process(base64_source, size=(0, 0), verify_resolution=False, quality=0 """Process the `base64_source` image by executing the given operations and return the result as a base64 encoded image. """ - if (not base64_source or not size or (not size[0] and not size[1])) and not verify_resolution and not quality and not crop and not colorize and not output_format: + if not base64_source or ((not size or (not size[0] and not size[1])) and not verify_resolution and not quality and not crop and not colorize and not output_format): # for performance: don't do anything if the image is falsy or if # no operations have been requested return base64_source