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

THRIFT-4446: JSONProtocol Base64 Encoding: Do not trim padding on encode. #1463

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/csharp/src/Protocol/TJSONProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,6 @@ private void WriteJSONBase64(byte[] b)
int len = b.Length;
int off = 0;

// Ignore padding
int bound = len >= 2 ? len - 2 : 0;
for (int i = len - 1; i >= bound && b[i] == '='; --i) {
--len;
}
while (len >= 3)
{
// Encode 3 bytes at a time
Expand Down
10 changes: 1 addition & 9 deletions lib/netcore/Thrift/Protocols/TJSONProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,6 @@ private async Task WriteJsonBase64Async(byte[] b, CancellationToken cancellation
var len = b.Length;
var off = 0;

// Ignore padding
var bound = len >= 2 ? len - 2 : 0;

for (var i = len - 1; i >= bound && b[i] == '='; --i)
{
--len;
}

while (len >= 3)
{
// Encode 3 bytes at a time
Expand Down Expand Up @@ -1167,4 +1159,4 @@ public async Task<byte> PeekAsync(CancellationToken cancellationToken)
}
}
}
}
}