Fix base64 image parser returning wrong hashes

This commit is contained in:
Slendy 2023-01-22 05:03:41 -06:00
commit 07769e0349
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -277,8 +277,8 @@ public static class FileHelper
private static byte[]? TryParseBase64Data(string b64)
{
Span<byte> buffer = new(new byte[b64.Length]);
bool valid = Convert.TryFromBase64String(b64, buffer, out _);
return valid ? buffer.ToArray() : null;
bool valid = Convert.TryFromBase64String(b64, buffer, out int bytesWritten);
return valid ? buffer[..bytesWritten].ToArray() : null;
}
public static async Task<string?> ParseBase64Image(string? image)