[go: nahoru, domu]

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: Base64 decoding to discard newline characters #1941

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
Commented out the reference implementation in test
  • Loading branch information
suztomo committed May 15, 2024
commit 5cee049d101272170980d4fb4355cd5d6aa01a99
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ public void test_decodeBase64_newline_character_invalid_length() {

// This is a reference implementation by Apache Commons Codec. It discards the new line
// characters.
assertEquals(
"abcdef",
new String(
org.apache.commons.codec.binary.Base64.decodeBase64(encodedString),
StandardCharsets.UTF_8));
// assertEquals(
// "abcdef",
// new String(
// org.apache.commons.codec.binary.Base64.decodeBase64(encodedString),
// StandardCharsets.UTF_8));

// This is our implementation
assertEquals("abcdef", new String(Base64.decodeBase64(encodedString), StandardCharsets.UTF_8));
}
Expand All @@ -95,11 +96,12 @@ public void test_decodeBase64_newline_character_between() {

// This is a reference implementation by Apache Commons Codec. It discards the new line
// characters.
assertEquals(
"ab",
new String(
org.apache.commons.codec.binary.Base64.decodeBase64(encodedString),
StandardCharsets.UTF_8));
// assertEquals(
// "ab",
// new String(
// org.apache.commons.codec.binary.Base64.decodeBase64(encodedString),
// StandardCharsets.UTF_8));

// This is our implementation
assertEquals("ab", new String(Base64.decodeBase64(encodedString), StandardCharsets.UTF_8));
}
Expand Down
Loading