Skip to content

fix: Base64 decoding to discard newline characters #1941

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

Merged
merged 7 commits into from
May 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clarified comment
  • Loading branch information
suztomo committed May 16, 2024
commit 2c5772d791ff07ed4b7670287b5413c1e406fd02
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
public class Base64 {
// Guava's Base64 (https://datatracker.ietf.org/doc/html/rfc4648#section-4) decoders. When
// decoding, they discard the new line character so that the behavior matches what we had with
// Apache Commons Codec's decodeBase64. When encoding, they would insert a new line character
// every 64 (the 2nd argument of withSeparator method) characters. They are not used for encoding.
// Apache Commons Codec's decodeBase64.
// The 2nd argument of the withSeparator method, "64", does not have any effect in decoding.
private static final BaseEncoding BASE64_DECODER = BaseEncoding.base64().withSeparator("\n", 64);
private static final BaseEncoding BASE64URL_DECODER =
BaseEncoding.base64Url().withSeparator("\n", 64);
Expand Down