Skip to content

Commit 71749f1

Browse files
committed
fix display order for ArchiveFile
1 parent cf80555 commit 71749f1

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

comiclib/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ def extract_archive(id: str, force: bool = True, db: Session = Depends(get_db)):
288288
pages = [f"./api/archives/{id}/page?path="+quote(p.name, safe='') for p in sorted(path.iterdir()) if is_image(p)]
289289
elif ArchiveFile.support_formats.fullmatch(path.name):
290290
with ArchiveFile(path) as z:
291-
pages = [f"./api/archives/{id}/page?path="+quote(z_info.filename, safe='') for z_info in filter(
292-
lambda z_info: not z_info.is_dir() and is_image(z_info.filename), z.infolist())]
291+
pages = [f"./api/archives/{id}/page?path="+quote(filename, safe='') for filename in sorted(map(lambda z_info: z_info.filename, filter(lambda z_info: not z_info.is_dir() and is_image(z_info.filename), z.infolist())))]
293292
else:
294293
raise NotImplementedError
295294
return {"job": -1, "pages": pages}

comiclib/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def extract_thumbnail(path: Union[str, Path], id: str, page: int, cache=False, c
5656
convert_image(sorted(filter(is_image, path.iterdir()))[page-1], saveto, thumbnail=True)
5757
elif ArchiveFile.support_formats.fullmatch(path.name):
5858
with ArchiveFile(path) as z:
59-
with z.open(list(filter(lambda z_info: not z_info.is_dir() and is_image(z_info.filename), z.infolist()))[page-1].filename) as f:
59+
with z.open(sorted(map(lambda z_info: z_info.filename, filter(lambda z_info: not z_info.is_dir() and is_image(z_info.filename), z.infolist())))[page-1]) as f:
6060
convert_image(f, saveto, thumbnail=True)
6161
else:
6262
raise NotImplementedError

0 commit comments

Comments
 (0)