-
Notifications
You must be signed in to change notification settings - Fork 2
fix(install): resolve latest tag from the releases/latest redirect, not API JSON - #33
Merged
Merged
Conversation
...ot API JSON
Version resolution parsed the GitHub API response with
awk -F'"' '/"tag_name"/ {print 4ドル; exit}', which assumes pretty-printed
one-field-per-line JSON. A TLS-inspecting middlebox on a user's machine
re-served the response minified onto one line; awk then matched the whole
object and 4ドル was the value of its first quoted field ("url"), so VERSION
became .../releases/<release-id> and the DMG download 404ed —
deterministically, so re-running never helped.
Resolve the tag from the https://github.com/<repo>/releases/latest
redirect instead (curl -w '%{redirect_url}', basename). No JSON to parse,
no shape to mangle, and no api.github.com unauthenticated rate limit.
The Go-side check (update/check.go) uses encoding/json and was never
affected; all other downloads are line-oriented text or SHA256-gated.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
A user's install failed every time with:
361182589is v0.4.0's release id. Version resolution parsed thereleases/latestAPI JSON withawk -F'"' '/"tag_name"/ {print 4ドル; exit}', which silently assumes GitHub's pretty-printed one-field-per-line layout. The user's machine (TLS-inspecting security software) re-served the same JSON minified onto one line — awk then matched the whole object and4ドルwas the value of its first quoted field,"url". The resulting garbageVERSION404s deterministically, so re-running never helps.Reproduced locally by piping the API response through
jq -c: output matches the user's report byte-for-byte.Fix
Resolve the tag from the
https://github.com/<repo>/releases/latestredirect instead:Locationheader survives any middlebox.api.github.comdependency, which also removes its 60 req/hour unauthenticated rate limit (the old error message had to apologize for exactly that).v*so a future resolution failure errors at the source instead of producing a nonsense URL.Not affected:
update/check.gousesencoding/json(whitespace-immune). Audited every other download — modelmanifest.txtandchecksums.txtare line-oriented by design; ggufs/DMG/update-zip are SHA256-gated. The awk was the only shape-dependent parse.Testing
v0.4.0from the redirect, downloads the DMG, checksum verifies, installs.bash -nclean.🤖 Generated with Claude Code