Skip to content

Fix 401 on Check for updates by skipping the empty Authorization header - #1

Open
shrenixcodes wants to merge 1 commit into
mainfrom
fix/update-check-401
Open

shrenixcodes wants to merge 1 commit into
mainfrom
fix/update-check-401

Conversation

@shrenixcodes

Copy link
Copy Markdown
Owner

What changed

UreqHttp::api in crates/core/src/github.rs now adds the Authorization header only when a token is present. Calls with an empty token go out as anonymous requests.

Why

The update check (updater::check_for_update) calls GET /repos/{repo}/releases/latest with an empty token. The header was still sent as Authorization: Bearer with nothing after it, and GitHub rejects that with 401. In Settings → Application Updates this showed up as:

update server answered unexpectedly: status 401

Checked with curl against shrenixcodes/RustGit:

  • no header → 200
  • Authorization: Bearer → 401

Reviewer notes

  • Calls that pass a real token are unchanged. The token is trimmed before use.
  • Anonymous requests share GitHub's unauthenticated rate limit (60/hour per IP), which is enough for a manual update check.
  • cargo test -p rustgit-core passes. Not yet tried in a rebuilt desktop app.

🤖 Generated with Claude Code

The update check calls the releases API anonymously with an empty token,
but the header was always sent as "Bearer " with nothing after it, which
GitHub rejects with 401. Only send the header when a token is present.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant