-
-
Notifications
You must be signed in to change notification settings - Fork 683
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
asBase64Decoded does not work with URL-safe base64 string #3069
Labels
status: ideal for contribution
An issue that a contributor can help us with
Comments
Being the URL encoding different from the basic one, what if we would add URL-specific methods?
|
@scordio I like your suggestion. |
Thanks @bjansen for your feedback 🙂 I marked this issue as ideal for contribution. |
OK, I'll try opening a PR then. |
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Certain Strings containing "~" when base64 ended end up with a "+" in the output base64, however this is not ideal when used in URLs, so there's a specific variant of Base64 that is URL safe, which results in a "-" in the output instead. The JDK includes
Base64.getUrlEncoder()
/Base64.getUrlDecoder()
for this usecase.When using AssertJ's
asBase64Decoded
, it fails since it's not allowing the URL safe variant.Test case reproducing the bug
Expected: Assertion pass
Actual:
java.lang.AssertionError:
Expecting "Zm9-bw==" to be a valid Base64 encoded string
The text was updated successfully, but these errors were encountered: