mirror of
https://github.com/hyugogirubato/cbz.git
synced 2026-09-26 21:41:03 +00:00
more flexible suffix check
This commit is contained in:
+8
-2
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import zipfile
|
||||
|
||||
from datetime import datetime, timezone
|
||||
@@ -172,8 +173,13 @@ class ComicInfo(ComicModel):
|
||||
pages_info = comic_info.get('Pages', {}).get('Page', [])
|
||||
for i, name in enumerate(names):
|
||||
suffix = Path(name).suffix
|
||||
if suffix:
|
||||
assert suffix in IMAGE_FORMAT, f'Unsupported image format: {suffix}'
|
||||
|
||||
# Some archives may contain folders or hidden files (e.g., ".extra/" or "__MACOSX/.DS_Store")
|
||||
# that could corrupt the suffix detection and cause invalid image handling.
|
||||
if not suffix or suffix not in IMAGE_FORMAT:
|
||||
logging.warning(f'Skipping unsupported or invalid file: {name!r} (suffix={suffix!r})')
|
||||
continue
|
||||
|
||||
with archive_file.open(name, 'r') as f:
|
||||
page_info = {}
|
||||
if i < len(pages_info):
|
||||
|
||||
Reference in New Issue
Block a user