Skip to content

Commit

Permalink
Metadata Page Size Bugs (#139)
Browse files Browse the repository at this point in the history
* Don't calculate page size when writing MetronInfo.
* Skip page images that give DecompressionBombError exception
  • Loading branch information
bpepple authored Dec 1, 2024
1 parent 9a2927f commit 5ee4933
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion darkseid/comic.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def _write_ci(self: Comic, metadata: Metadata | None) -> bool:
def _write_mi(self: Comic, metadata: Metadata | None) -> bool:
if metadata is None or not self.is_writable():
return False
self.apply_archive_info_to_metadata(metadata, calc_page_sizes=True)
self.apply_archive_info_to_metadata(metadata, calc_page_sizes=False)
if raw_metadata := self.read_raw_mi_metadata():
md_string = MetronInfo().string_from_metadata(metadata, raw_metadata.encode("utf-8"))
else:
Expand Down Expand Up @@ -590,6 +590,8 @@ def apply_archive_info_to_metadata(
page["ImageWidth"] = str(width)
except OSError:
page["ImageSize"] = str(len(data))
except Image.DecompressionBombError: # Let's skip these images
continue

def export_as_zip(self: Comic, zip_filename: Path) -> bool:
"""
Expand Down

0 comments on commit 5ee4933

Please sign in to comment.