Handle more error types when opening/saving images with PIL
Decoding/encoding errors sometimes raise an OSError or ValueError.
This commit is contained in:
@@ -302,7 +302,7 @@ class DetailsDialog(Adw.Dialog):
|
||||
with Image.open(path) as image:
|
||||
if getattr(image, "is_animated", False):
|
||||
new_path = convert_cover(path)
|
||||
except UnidentifiedImageError:
|
||||
except (UnidentifiedImageError, OSError, ValueError):
|
||||
pass
|
||||
|
||||
if new_path:
|
||||
|
||||
@@ -63,7 +63,7 @@ def convert_cover(
|
||||
if shared.schema.get_boolean("high-quality-images")
|
||||
else shared.TIFF_COMPRESSION,
|
||||
)
|
||||
except UnidentifiedImageError:
|
||||
except (UnidentifiedImageError, OSError, ValueError):
|
||||
try:
|
||||
Gdk.Texture.new_from_filename(str(cover_path)).save_to_tiff(
|
||||
tmp_path := Gio.File.new_tmp("XXXXXX.tiff")[0].get_path()
|
||||
|
||||
Reference in New Issue
Block a user