fix(content): resolve current ZIM URL before download#1091
Conversation
|
Reviewed this against the current |
|
@chriscrosstalk thanks for the detailed review — appreciate it! |
jakeaturner
left a comment
There was a problem hiding this comment.
@NgoQuocViet2001 this is a great addition, thank you! Only one small caveat that will need to be addressed before merge: because the version field is a string, plain comparison will break in some cases, for example, '2026-10' < '2026-2'. We'll need to either attempt to parse the version to a date object first, or break it up into something like a tuple and parse as ints (e.g. [2026, 10]) so we can avoid those edge-cases.
223cde5 to
c69f4c0
Compare
|
@jakeaturner Thanks for catching this. Fixed in c69f4c0: ZIM year/month versions are now parsed and compared numerically, so |
|
🎉 This PR is included in version 1.34.0-rc.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
…out choice Bump to 0.2.752-macos. This batch ports 10 upstream v1.34 items (UA-403 Crosstalk-Solutions#1114, image-prune Crosstalk-Solutions#1101, CONTRIBUTING Crosstalk-Solutions#1080, Linux script colors Crosstalk-Solutions#1098, .docx Crosstalk-Solutions#1100, debug-info Crosstalk-Solutions#1102, What's-new banner Crosstalk-Solutions#1112, ZIM extraction Crosstalk-Solutions#1044, download retry Crosstalk-Solutions#1059, opt-in model thinking Crosstalk-Solutions#1079) and adds a Grid/Decks home-layout choice (traditional grid now default). Deferred with reasons: Crosstalk-Solutions#1091 (needs a Kiwix catalog service we lack), Crosstalk-Solutions#1060 (virtualization regression). Crosstalk-Solutions#1127 (nomad.md) and Crosstalk-Solutions#1063 (KB collections, Crosstalk-Solutions#883 migration) split off to focused sessions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
YYYY-M/YYYY-MMversions numerically so October is newer than February.Problem
Curated manifests pin dated ZIM URLs. Kiwix rotates filenames and removes old files, so fresh downloads can return 404 until the JSON is manually refreshed.
Solution
Reuse the existing bounded
KiwixCatalogService.getLatestForResources()lookup used by the updater, then dispatch with the resolved URL, version, and size. Per-resource catalog failures produce no map entry, so the static manifest remains the fallback.Version comparison parses the catalog's year/month values numerically, avoiding lexicographic ordering errors such as
2026-10 < 2026-2.Closes #1045
Verification
npx tsx --test tests/unit/zim_download_resolution.spec.ts— 5/5 passednpm run typechecknpm run buildnpx prettier --check app/utils/zim_download_resolution.ts tests/unit/zim_download_resolution.spec.tsnpx eslint app/utils/zim_download_resolution.ts tests/unit/zim_download_resolution.spec.tsgit diff --checkLocal environment note
A full Adonis test boot on Windows is blocked by
@openzim/libzim, which has no Windows native binding. The focused unit suite runs directly without booting the native service; the repository's Linux CI remains authoritative for the native suite.