OCA / website

Odoo website builder addons
GNU Affero General Public License v3.0
259 stars 693 forks source link

[13.0][FIX] website_prevent_cls: ensure bin_size is False before retreving signature #1001

Closed em230418 closed 4 months ago

em230418 commented 1 year ago

Before this PR this traceback could appear if bin_size is True.

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/odoo/tools/cache.py", line 88, in lookup
    r = d[key]
  File "/usr/local/lib/python3.6/site-packages/odoo/tools/func.py", line 69, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/odoo/tools/lru.py", line 44, in __getitem__
    a = self.d[obj].me
KeyError: ('ir.qweb.field.image', <function Image._get_image_size at 0x7f2ded65d1e0>, '83.24 Kb')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/extra-addons/OCA/website/website_prevent_cls/tools/image.py", line 23, in base64_to_image
    return Image.open(io.BytesIO(base64.b64decode(base64_source)))
  File "/usr/local/lib/python3.6/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/mnt/extra-addons/OCA/website/website_prevent_cls/models/ir_qweb_fields.py", line 42, in record_to_html
    width, height = self._get_image_size(record, field_name, base64_signature)
  File "<decorator-gen-268>", line 2, in _get_image_size
  File "/usr/local/lib/python3.6/site-packages/odoo/tools/cache.py", line 93, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/mnt/extra-addons/OCA/website/website_prevent_cls/models/ir_qweb_fields.py", line 29, in _get_image_size
    image = base64_to_image(base64_source)
  File "/mnt/extra-addons/OCA/website/website_prevent_cls/tools/image.py", line 25, in base64_to_image
    raise UserError(_("This file could not be decoded as an image file."
odoo.exceptions.UserError: ('This file could not be decoded as an image file.Please try with a different file.', '')
github-actions[bot] commented 10 months ago

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

em230418 commented 10 months ago

hello, @OCA/website-maintainers ! Could you please mark this PR as "no stale" please?

github-actions[bot] commented 5 months ago

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.