mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Fix Base64 Decode Padding
Base64 decode padding calculation error Fixes #415
This commit is contained in:
@@ -31,7 +31,7 @@ namespace RuriLib.Functions.Formats
|
||||
{
|
||||
var toDecode = base64EncodedData.Replace(".", "");
|
||||
var remainder = toDecode.Length % 4;
|
||||
if (remainder != 0) toDecode = toDecode.PadRight(toDecode.Length + remainder, '=');
|
||||
if (remainder != 0) toDecode = toDecode.PadRight(toDecode.Length + (4 - remainder), '=');
|
||||
var base64EncodedBytes = System.Convert.FromBase64String(toDecode);
|
||||
return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user