fix validation

This commit is contained in:
rootdarkarchon
2024-02-26 19:41:38 +01:00
committed by Loporrit
parent 336a2f3732
commit 8c0c45df35

View File

@@ -100,10 +100,18 @@ public sealed class FileCacheManager : IHostedService
continue; continue;
} }
var computedHash = Crypto.GetFileHash(fileCache.ResolvedFilepath); try
if (!string.Equals(computedHash, fileCache.Hash, StringComparison.Ordinal))
{ {
_logger.LogInformation("Failed to validate {file}, got hash {hash}, expected hash {hash}", fileCache.ResolvedFilepath, computedHash, fileCache.Hash); var computedHash = Crypto.GetFileHash(fileCache.ResolvedFilepath);
if (!string.Equals(computedHash, fileCache.Hash, StringComparison.Ordinal))
{
_logger.LogInformation("Failed to validate {file}, got hash {hash}, expected hash {hash}", fileCache.ResolvedFilepath, computedHash, fileCache.Hash);
brokenEntities.Add(fileCache);
}
}
catch (Exception e)
{
_logger.LogWarning("Error during validation of {file}", fileCache.ResolvedFilepath);
brokenEntities.Add(fileCache); brokenEntities.Add(fileCache);
} }
} }