mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
63a57b9269
The Atlas hero counted more countries than the continent bars below it drew, and more than the dashboard widget. The extra ones were invented: a place without coordinates fell back to parsing its address, and any two-letter uppercase segment at the end became a country code. "New York, NY" produced NY, "Toronto, ON" produced ON. Those phantoms only ever showed up in the one number. The continent strip files an unknown code under 'Other' and never draws it, the map skips codes it cannot resolve, and the dashboard builds its set from stored regions instead, which is why it stayed right. Filtering against a list of valid codes would not have been enough, and would have hidden the worse half of this: 26 US state abbreviations are real ISO country codes. CA is California far more often than Canada, DE is Delaware, IN is Indiana. The existing comment above resolveCountryCode already describes that collision and solves it by trusting coordinates first and sanity-checking the address against the country's own bounding box. The gap it names in its last line is this bug: with no coordinates there is nothing to check against. So the bare-code branch is now only offered to callers that have coordinates. A spelled-out country name still resolves either way. A lone "NY" or "CA" resolves to nothing, which is the honest answer. Fixes #2111