From 07769e034917a21d01be79e0b3363c0d9e828a76 Mon Sep 17 00:00:00 2001 From: Slendy Date: Sun, 22 Jan 2023 05:03:41 -0600 Subject: [PATCH] Fix base64 image parser returning wrong hashes --- ProjectLighthouse/Files/FileHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProjectLighthouse/Files/FileHelper.cs b/ProjectLighthouse/Files/FileHelper.cs index 0a2ec16b..9315e192 100644 --- a/ProjectLighthouse/Files/FileHelper.cs +++ b/ProjectLighthouse/Files/FileHelper.cs @@ -277,8 +277,8 @@ public static class FileHelper private static byte[]? TryParseBase64Data(string b64) { Span 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 ParseBase64Image(string? image)