Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/tagstudio/previews/renderers/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def first_image_in_archive(archive: Archive) -> Image | None:
Image: The first renderable image in the archive.
"""
for file_name in archive.namelist(): # pyright: ignore[reportUnknownVariableType]
ext = Path(file_name).suffix
archive_path = Path(file_name)
ext = archive_path.suffix.lower() if archive_path.suffix else archive_path.stem
if MediaTypes.image_raster.contains(ext, RENDER):
image_data = archive.read(file_name) # pyright: ignore[reportUnknownVariableType]
return image_from_bytes(BytesIO(image_data))
Expand Down
2 changes: 1 addition & 1 deletion src/tagstudio/previews/renderers/ebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def cover_from_comic_info(archive: Archive, comic_info: Element, cover_type: str
if cover is not None:
pages = [f for f in archive.namelist() if f != "ComicInfo.xml"] # pyright: ignore[reportUnknownVariableType]
page_name = pages[int(unwrap(cover.get("Image")))] # pyright: ignore[reportUnknownVariableType]
ext = Path(page_name).suffix
ext = Path(page_name).suffix.lower()

@Sola-ris Sola-ris Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm intentionally not checking for the stem here, since comics with a ComicInfo.xml should only contain it and the (numbered) images so if there's a file without an extension the renderer wouldn't work properly anyways

if MediaTypes.image_raster.contains(ext, RENDER):
image_data = archive.read(page_name) # pyright: ignore[reportUnknownVariableType]
im = image_from_bytes(BytesIO(image_data))
Expand Down
Loading