Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
ef7284fe by wurstsalat at 2021-12-12T22:51:53+01:00
Preview: Catch error when saving PIL image fails
Fixes #10721
- - - - -
1 changed file:
- gajim/common/preview_helpers.py
Changes:
=====================================
gajim/common/preview_helpers.py
=====================================
@@ -204,11 +204,16 @@ def create_thumbnail_with_pil(data: bytes, size: int) ->
Optional[bytes]:
if image.format == 'GIF' and image.n_frames > 1:
resize_gif(image, output_file, (size, size))
else:
- image.thumbnail((size, size))
- image.save(output_file,
- format=image.format,
- exif=image.info.get('exif', b''),
- optimize=True)
+ try:
+ image.thumbnail((size, size))
+ image.save(
+ output_file,
+ format=image.format,
+ exif=image.info.get('exif', b''),
+ optimize=True)
+ except OSError as error:
+ log.warning('saving pil thumbnail failed: %s', error)
+ return None
bytes_ = output_file.getvalue()
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ef7284fe4b38af16191d2a92d2a3701417772540
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ef7284fe4b38af16191d2a92d2a3701417772540
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits