Repository navigation
Add fuzzy rule to rewrite URLs of lesbases.anct.gouv.fr (Fixes #334) - #352
Conversation
|
@Sriram-Nambiar can you please share a working ZIM of lesbases.anct.gouv.fr? few pages is enough, no need to ZIM the whole website, just confirm the regex is working fine and they did not changed something which will cause it to fail again |
|
Hi @benoit74 I generated a small sample ZIM and tested it When clicking on links like I've attached |
|
Thank you very much! Do I get it correctly that JS code is inspecting the content-type header returned to take a decision? |
|
I also see that the main page keeps loading assets ... should we tweak the fuzzy-rule so that |
|
Yes, you're correct! Next.js analyzes the Content-Type header of background fetches and determines whether they're of type React Server Components (text/x-component) or HTML (text/html). That's because the _rsc parameter is Next.js's cache-buster hash for those component payloads, and as such varies between builds and router states. Your suggestion of keeping _rsc with a fixed value (_rsc=1) worked nicely! I tested it on a sample ZIM with 7 pages, and both the HTML and component files are saved separately now without overwriting each other, so /connexion loads cleanly. I've attached a screenshot and the sample ZIM below. If this looks good to you, should I go ahead and push the updated rule to this PR?
|
|
I still see continuous web requests on home page in the new ZIM ... as if Next.js considered some pages were not fine and needed to be downloaded again |
|
Nice, makes sense. Please go ahead and push the updated rule (please simply amend your commit and rebase on latest main commit) |
49bd5be to
077a542
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #352 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 42 42
Lines 2729 2729
Branches 406 406
=========================================
Hits 2729 2729 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



Fixes #334
Related to openzim/zim-requests#1205
Summary of Changes:
lesbases.anct.gouv.frinrules/rules.yamlto normalize Next.js_rscquery parameters to a fixed value (_rsc=1).CHANGELOG.mdunder[Unreleased]->Added.