Skip to content

Commit

Permalink
THRIFT-4446: JSONProtocol Base64 Encoding: Do not trim padding on enc…
Browse files Browse the repository at this point in the history
…ode.

Client: csharp
Client: netcore

This closes #1463
  • Loading branch information
license-fn authored and jeking3 committed Jan 11, 2018
1 parent d3355af commit d066fa8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
5 changes: 0 additions & 5 deletions lib/csharp/src/Protocol/TJSONProtocol.cs
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
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)
}
}
}
}
}

0 comments on commit d066fa8

Please sign in to comment.