Skip to content

fix(download): Ignore an unusable GitHub token and keep it on redirects - #6826

Merged
niheaven merged 4 commits into
developfrom
fix/ignore-unusable-gh-token
Nov 9, 2026
Merged

niheaven merged 4 commits into
developfrom
fix/ignore-unusable-gh-token

Conversation

@niheaven

@niheaven niheaven commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Description

  • A gh_token that is invalid or expired no longer aborts the download of a public release asset. The asset is downloaded anonymously and a warning is shown.
  • A renamed repository is no longer queried anonymously, so the download and the hash lookup keep working when the anonymous GitHub API quota is exhausted.
  • The GitHub token is not sent to any host other than api.github.com.
  • The download no longer fails with an empty aria2 input file or with URL ... is not valid.

Motivation and Context

How Has This Been Tested?

The full test suite was run on Windows PowerShell 5.1 and PowerShell 7, together with the new unit tests for the token handling. The fix was verified against the GitHub API with a misconfigured gh_token: the query fails with 401, a warning is shown and the asset is downloaded anonymously. With a valid token a renamed repository is resolved with the token still attached (X-RateLimit-Limit: 5000 instead of 60), and the hash lookups were checked on both PowerShell versions.

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the previous text-decoding issue is fixed.

Summary

The PR lets public release downloads continue when a GitHub token cannot be used. It also keeps the token on redirects within the GitHub API.

  • GitHub API requests keep their token on redirects within GitHub.
  • A failed GitHub token check leaves the original release link available.
  • Checkver and hash lookups share one remote-text reader.

Reviews (3) · Last reviewed commit: "fix(download): Read the charset of a htt..." · Reviewed by Greptile

Comment thread lib/download.ps1 Resolved
Comment thread lib/download.ps1 Resolved
Comment thread lib/download.ps1 Resolved
@niheaven
niheaven merged commit 8612f74 into develop Nov 9, 2026
3 checks passed
@niheaven
niheaven deleted the fix/ignore-unusable-gh-token branch November 9, 2026 13:05
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