mirror of
https://github.com/hyugogirubato/cbz.git
synced 2026-09-26 21:41:03 +00:00
Compare commits
7
Commits
v3.4.4
...
d37be87c2f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d37be87c2f | ||
|
|
0b011a7efc | ||
|
|
62b8cf5739 | ||
|
|
871716971a | ||
|
|
597cb41b00 | ||
|
|
a489ae17fb | ||
|
|
abc69d4673 |
@@ -10,7 +10,7 @@ jobs:
|
|||||||
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
|
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
|
|||||||
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [3.4.5] - 2025-10-19
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- More flexible suffix checking to support complex archive paths.
|
||||||
|
- Improved validation in `PageInfo.load()` to handle empty or invalid data correctly.
|
||||||
|
|
||||||
## [3.4.4] - 2025-09-21
|
## [3.4.4] - 2025-09-21
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -225,6 +232,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
|
|
||||||
- Initial release.
|
- Initial release.
|
||||||
|
|
||||||
|
[3.4.5]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.5
|
||||||
[3.4.4]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.4
|
[3.4.4]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.4
|
||||||
[3.4.3]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.3
|
[3.4.3]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.3
|
||||||
[3.4.2]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.2
|
[3.4.2]: https://github.com/hyugogirubato/cbz/releases/tag/v3.4.2
|
||||||
|
|||||||
+8
-2
@@ -1,5 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
@@ -172,8 +173,13 @@ class ComicInfo(ComicModel):
|
|||||||
pages_info = comic_info.get('Pages', {}).get('Page', [])
|
pages_info = comic_info.get('Pages', {}).get('Page', [])
|
||||||
for i, name in enumerate(names):
|
for i, name in enumerate(names):
|
||||||
suffix = Path(name).suffix
|
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 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:
|
with archive_file.open(name, 'r') as f:
|
||||||
page_info = {}
|
page_info = {}
|
||||||
if i < len(pages_info):
|
if i < len(pages_info):
|
||||||
|
|||||||
+3
-1
@@ -75,6 +75,8 @@ class PageInfo(PageModel):
|
|||||||
data = base64.b64decode(data)
|
data = base64.b64decode(data)
|
||||||
if not isinstance(data, bytes):
|
if not isinstance(data, bytes):
|
||||||
raise ValueError(f'Expecting Bytes or Base64 input, got {data!r}')
|
raise ValueError(f'Expecting Bytes or Base64 input, got {data!r}')
|
||||||
|
if not data.strip():
|
||||||
|
raise ValueError(f'Empty or null data provided (length={len(data)})')
|
||||||
return cls(data, **kwargs)
|
return cls(data, **kwargs)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -98,7 +100,7 @@ class PageInfo(PageModel):
|
|||||||
path = Path(path)
|
path = Path(path)
|
||||||
with path.open(mode='rb') as f:
|
with path.open(mode='rb') as f:
|
||||||
kwargs.setdefault('name', path.name)
|
kwargs.setdefault('name', path.name)
|
||||||
return cls(f.read(), **kwargs)
|
return cls.loads(f.read(), **kwargs)
|
||||||
|
|
||||||
def show(self) -> None:
|
def show(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "cbz"
|
name = "cbz"
|
||||||
version = "3.4.4"
|
version = "3.4.5"
|
||||||
description = "CBZ simplifies creating, managing, and viewing comic book files in CBZ, CBR, and PDF formats, offering seamless packaging, metadata handling and built-in viewing capabilities."
|
description = "CBZ simplifies creating, managing, and viewing comic book files in CBZ, CBR, and PDF formats, offering seamless packaging, metadata handling and built-in viewing capabilities."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["hyugogirubato <65763543+hyugogirubato@users.noreply.github.com>"]
|
authors = ["hyugogirubato <65763543+hyugogirubato@users.noreply.github.com>"]
|
||||||
|
|||||||
Reference in New Issue
Block a user