Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] dms: try/except for thumbnail generation of dms.file #237

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

aleuffre
Copy link
Contributor

@aleuffre aleuffre commented Apr 3, 2023

FW of #236

Cherry pick of d8fde2e

@aleuffre aleuffre marked this pull request as draft April 4, 2023 07:37
@aleuffre aleuffre marked this pull request as ready for review April 20, 2023 09:38
The method _compute_image_1920 of dms_file checks if the file is of
mimetype image and tries to use it as a thumbnail.
However, there are several types of image files that Odoo/PIL
cannot work with, leading to the following error:

```
Traceback (most recent call last):
  File "/opt/odoo/custom/src/odoo/odoo/tools/image.py", line 404, in base64_to_image
    return Image.open(io.BytesIO(base64.b64decode(base64_source)))
  File "/usr/local/lib/python3.6/site-packages/PIL/Image.py", line 2687, in open
    % (filename if filename else fp))
OSError: cannot identify image file <_io.BytesIO object at 0x7f0a6ecb1780>
```

and also further down

```
odoo.exceptions.UserError: ('This file could not be decoded as an image file. Please try with a different file.', '')
```

Examples of such files are CAD files (mimetype: image/vnd.dwg)
For a list of all mimetypes starting with "image/" see:
https://www.iana.org/assignments/media-types/media-types.xhtml#image
@pedrobaeza pedrobaeza added this to the 14.0 milestone Apr 20, 2023
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 14.0-ocabot-merge-pr-237-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 3c50dc3 into OCA:14.0 Apr 20, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 0a7bdec. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants