Skip to content

Commit

Permalink
Fix type hints and add CHANGELOG
Browse files Browse the repository at this point in the history
Nota: the two on content and mimetype are just linked to
openzim/python-scraperlib#196
and will have to be reverted once this issue is fixed
  • Loading branch information
benoit74 committed Oct 8, 2024
1 parent 5d452e1 commit 3c7363f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Enrich test website with img srcset situations (in preparation for #403)

### Fixed

- HTML document can be retrieved as `fetch` resource type (#405)

## [2.1.1] - 2024-09-05

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/warc2zim/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pathlib import Path

from jinja2.environment import Template
from libzim.writer import Hint # pyright: ignore[reportMissingImports]
from libzim.writer import Hint # pyright: ignore[reportMissingModuleSource]
from warcio.recordloader import ArcWarcRecord
from zimscraperlib.types import get_mime_for_name
from zimscraperlib.zim.items import StaticItem
Expand Down
8 changes: 6 additions & 2 deletions tests/test_warc_to_zim.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,15 @@ def verify_warc_and_zim(self, warcfile, zimfile):
elif record.rec_type == "response":
# We must have a payload
assert payload
payload_content = payload.content.tobytes()
payload_content = (
payload.content.tobytes() # pyright:ignore[reportAttributeAccessIssue]
)

# if HTML, still need to account for the head insert, otherwise should
# have exact match
if payload.mimetype.startswith("text/html"):
if payload.mimetype.startswith( # pyright:ignore[reportAttributeAccessIssue]
"text/html"
):
assert head_insert in payload_content
elif record.rec_type == "resource":
# we do not want to embed resources "as-is"
Expand Down

0 comments on commit 3c7363f

Please sign in to comment.