mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-05-28 15:16:49 +02:00
onWikipediaDownloadComplete was deleting every file whose name starts with `wikipedia_en_`, treating distinct corpora (simple, medicine, wikivoyage, climate_change, etc.) as competing versions of the same selection slot. Whichever wiki finished second silently wiped the other from disk. Match by filename stem instead — strip the trailing `_YYYY-MM(-DD).zim` date suffix and only delete files with the same stem as the new download. Different release dates of the same variant still get cleaned up; distinct variants are preserved. Extracted the predicate to `app/utils/zim_filename.ts` so the boundary is covered by unit tests (8 cases incl. the #884 repro scenario). |
||
|---|---|---|
| .. | ||
| downloads.ts | ||
| fs.ts | ||
| misc.ts | ||
| version.ts | ||
| zim_filename.ts | ||