Log calculated hash when failing to uploading a new resource

This commit is contained in:
jvyden 2021-11-23 17:03:33 -05:00
commit 23206b2a9b
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -70,9 +70,14 @@ namespace LBPUnion.ProjectLighthouse.Controllers
return this.UnprocessableEntity();
}
if (HashHelper.Sha1Hash(file.Data) != hash)
string calculatedHash = HashHelper.Sha1Hash(file.Data);
if (calculatedHash != hash)
{
Logger.Log($"File hash does not match the uploaded file! (hash: {hash}, type: {file.FileType})", LoggerLevelResources.Instance);
Logger.Log
(
$"File hash does not match the uploaded file! (hash: {hash}, calculatedHash: {calculatedHash}, type: {file.FileType})",
LoggerLevelResources.Instance
);
return this.Conflict();
}