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: avoid panic by checking response for nil #391

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

Zebradil
Copy link
Member

Fixes #389.

This PR addresses two issues:

  • panic in case of malformed API token
  • accidental trailing spaces in the token value

If the authorization header value contains a trailing newline, the http client returns error without a response struct (nil).

It is easy to miss a trailing newline when encoding a value into base64. To avoid inconvenience for users, let's trim it.

Signed-off-by: German Lashevich <german.lashevich@gmail.com>
Signed-off-by: German Lashevich <german.lashevich@gmail.com>
Copy link
Member

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joaopapereira joaopapereira merged commit 0c8f01a into carvel-dev:develop Jul 24, 2024
4 checks passed
@Zebradil Zebradil deleted the 389-fix-panic branch July 24, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Panic in vendir sync
2 participants