Repository navigation
Refuse weather coordinates off the globe - #18553
Merged
Merged
Conversation
--set checked only the shape of the pair, so 91,181 was stored and the panel asked Open-Meteo for a place that cannot exist, which never answers and leaves the bar without its weather icon. The range check runs inside the jq call that builds the file, since bash has no floats, and the file is written only when jq produced something. The panel's reader drops an off-globe pair and keeps the name, which also repairs a file saved before this change or written by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Muse Wonder High via Pi <noreply@meta.com>
Contributor
[Medium impact] This PR appears safe to merge. SummaryThis PR rejects weather coordinates outside the globe and preserves the saved location when JSON generation fails.
Reviews (1) · Last reviewed commit: "Refuse weather coordinates off the globe" · Reviewed by Greptile |
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.
omarchy-weather-location --set <name> 91,181stored coordinates that are not on the globe and exited 0, replacing the saved location.--setonly checked that the pair looked like two numbers, and the panel's reader ofweather.json(parseLocationFile) only checked that each value parsed, so the pair went to Open-Meteo, which answers HTTP 400 ("Latitude must be in range of -90 to 90°"). With coordinates set, only an Open-Meteo answer gives the bar its label, so the weather icon never appears and the panel stays on "Fetching forecast…". The same happens for aweather.jsonwritten by hand.--setnow refuses a latitude outside -90 to 90 or a longitude outside -180 to 180 withInvalid coordinates: 91,181 (latitude -90 to 90, longitude -180 to 180), exits 1 and leavesweather.jsonas it was. The edges, 90,180 and -90,-180, are still accepted. The check runs inside the jq call that already builds the file, since bash has no floats, and the file is written only when jq produced something: the script has noset -e, so a jq that printed nothing used to overwrite the location with an empty file.parseLocationFiledrops an off-globe pair and keeps the name, as it already does for a pair that does not parse. A file saved before this change, or written by hand, then gets the weather by the place's name.#16406 (live radar) range-checks the coordinates it sends to its radar view only; with this change that check becomes a second guard. #13113, #17454, #17452, #17443, #8278, #8277 and #16615 edit the same
--setorhasCoordinateslines, so whichever lands second carries the range check along.Found by Prime's QA run.
🤖 Generated by Opus 5.5 in Claude Code. Reviewed by Codex Medium and Muse Wonder High via Pi.