Repository navigation
Conversation
urllib.parse.urljoin collapses empty path segments while merging a relative reference onto the base URL, so a page whose own URL contains `//` had its relative links resolved to the wrong absolute URL (slashes collapsed before normalize() even saw them). Replace it with a custom join that follows RFC 3986 section 5.3 without that deviation, matching how browsers resolve such references. The JS (wombat) side already resolves relative URLs correctly via uri-js's URI.resolve, so only the Python rewriter needed a fix; added a regression test on the JS side to document that. Fix #346
|
@Sinkleberg / @anshuman83-40 I would be happy to have your feedback on this one. Cannot ask a formal review but would be happy to have an informal one ^^ Looks like there is no easy way besides re-implementing Python function ... |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #358 +/- ##
===========================================
- Coverage 100.00% 99.64% -0.36%
===========================================
Files 42 42
Lines 2798 2837 +39
Branches 417 431 +14
===========================================
+ Hits 2798 2827 +29
- Misses 0 4 +4
- Partials 0 6 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for picking this up! I had a look and it seems right to me:
About the coverage: in Small thing: |
Summary
ArticleUrlRewriterresolved relative links (andbase_href) withurllib.parse.urljoin, which collapses empty path segments while merging a relative reference onto the base URL. When a page's own URL contains//, this silently collapsed it beforenormalize()could see it, so the rewritten link pointed to an entry that doesn't exist in the ZIM.uri-js'sURI.resolve, which doesn't have this deviation, so no fix was needed there — added a regression test to document/lock in that behavior instead.Fix #346