-
Notifications
You must be signed in to change notification settings - Fork 25
Make the download cache insensitive to region-name spelling - #7
Open
FBumann wants to merge 1 commit into
Open
Conversation
The --country value is embedded verbatim in every cache key, so "Germany" and "germany" hash differently and the second spelling re-downloads all of the region's Overpass tiles despite the data already sitting in cache/. The same applies to stray surrounding whitespace. Fold case and whitespace when building cache keys so the spellings share a single cached download. Region names that differ in more than case still get distinct keys. Note this changes existing key values: a cache written with a capitalized name is re-downloaded once. Keys for names already typed in lower case are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
FBumann
marked this pull request as ready for review
August 15, 2026 21:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Small, but helpfull change, making the caching case insensitive
The bug
The
--countryvalue is embedded verbatim in every cache key, so the spelling of the region name decides whether a cached download is found:Confirmed against a populated cache:
'Germany''germany'The boundary line is misleading — that geocode happened to be cached under the lower-case spelling from an earlier attempt — but the tiles are the expensive part, so the run re-queries Overpass in full. On a rate-limited public endpoint that is the difference between an instant render and a long throttled download. Stray surrounding whitespace splits the cache the same way.
The fix
Fold case and surrounding whitespace when building cache keys, via a single
_cache_name()helper applied at the six sites where the region name feedscache_key(). Nothing else changes — the name is still displayed and geocoded exactly as typed.Verification
"Germany","germany","GERMANY"," Germany "→ 1 distinct cache key (was 4).Compatibility note
This changes existing key values. A cache written with a capitalized name is re-downloaded once; keys for names already typed in lower case are unchanged, since the normalized form equals the old raw form. Worth a mention in release notes if that matters for the gallery build.