Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #177 +/- ##
==========================================
+ Coverage 77.83% 77.92% +0.08%
==========================================
Files 68 68
Lines 4502 4502
Branches 725 725
==========================================
+ Hits 3504 3508 +4
Misses 793 793
+ Partials 205 201 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
changes
update_html_for_staticusedsoup.find("link", rel="icon"), so only the first<link rel="icon">of a book's HTML page got the{book_id}/prefix. Some Gutenberg books repeat the cover tag — book77225has two identical<link href="images/cover_front.jpg" rel="icon" type="image/x-cover">entries under different auto-generated ids — and the extra ones were left pointing atimages/cover_front.jpg.webp, outside the book's own folder. That is what makeszimcheckfail on those ZIMs.The loop now uses
find_all, so every icon link is rewritten._cover_href(used by cover detection) is still filled only once, by the first icon link that has an href..webpwas already appended to all of them — that part comes fromrewrite_html_image_references, which already usedfind_all; only the prefix was missing, which matches the screenshot in the issue.Tests
scraper/tests/test_gutenberg_rewriter.py: the repeated-tag head copied from77225(both links must end up as11/images/cover_front.jpg.webp) and a head whose icon links are not local assets (anchor/missing href are left untouched and do not poison_cover_href).pg77225-images.htmldownloaded from Gutenberg and passed throughupdate_html_for_staticwith a77225work now rewrites both icon links to77225/images/cover_front.jpg.webp.lint-black,lint-ruffandcheck-pyrightclean.fixes #176