Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for download failure when rest-client follows http redirect #334

Merged
merged 1 commit into from
Dec 4, 2021

Conversation

robinraju
Copy link
Owner

This PR tries to fix the issue described in #333

The following behaviour was observed when downloading files from a private repo.

  • Github assets API started returning 302 and a location to the actual asset.
  • The rest-client used in this action implicitly follows a redirect response along with the existing Authorization header.
  • The url returned by GH API through the Location header contains a new token required for authenticating their assets API as a query param.
  • It resulted in the following error
HttpError: <Error><Code>AccessDenied</Code><Message>Multiple auth mechanisms are not allowed; please use either query parameters or an Authorization header</Message>

Changes applied

Until a fix from typed-rest-client is available,

  • I disabled allowRedirects option from the HTTP client and created a new request after removing the Authorization header to follow a redirect.

- Remove Authorization header when following redirects
@robinraju robinraju merged commit 2ec9930 into main Dec 4, 2021
@robinraju robinraju deleted the fix/download-failure-on-http-redirect branch December 4, 2021 23:42
@robinraju robinraju linked an issue Dec 7, 2021 that may be closed by this pull request
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.

Getting 400 on all downloads
1 participant