Skip to content

fix(locale): don't leave a partial GeoIP database behind on failed download - #318

Merged
barjin merged 1 commit into
masterfrom
fix/mmdb-partial-download-cleanup
Jul 27, 2026
Merged

fix(locale): don't leave a partial GeoIP database behind on failed download#318
barjin merged 1 commit into
masterfrom
fix/mmdb-partial-download-cleanup

Conversation

@barjin

@barjin barjin commented Jul 27, 2026

Copy link
Copy Markdown
Member

downloadMMDB() streamed straight into MMDB_FILE, so an interrupted download left an empty or truncated database in place, and since getGeolocation() only checks that the file exists every later run reused the corrupt file and failed until it was deleted by hand. The download now goes into a temporary file that is renamed into place only once it completed, and the temporary file is removed on failure. Closing the stream before the rename also ensures the last buffered chunks are flushed before the database is opened. Refs #301

…wnload

downloadMMDB() streamed straight into MMDB_FILE, so an interrupted download
left an empty or truncated database in place. getGeolocation() only checks
that the file exists, so every later run reused the corrupt file and failed
until it was deleted by hand.

Download into a temporary file, close the stream and rename it into place
only once the download completed, removing the temporary file on failure.
Closing before the rename also makes sure the last buffered chunks are
flushed before the database is opened.

Refs #301

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added this to the 146th sprint - Tooling team milestone Jul 27, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Jul 27, 2026
@barjin barjin added the adhoc Ad-hoc unplanned task added during the sprint. label Jul 27, 2026
@barjin
barjin marked this pull request as ready for review July 27, 2026 12:27
@barjin
barjin merged commit ec7fb4d into master Jul 27, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants