Force SHA1 hashing on updated hash files

This commit is contained in:
cake
2025-12-02 06:33:08 +01:00
parent 481bc99dcd
commit 72cd5006db
7 changed files with 214 additions and 74 deletions

View File

@@ -449,13 +449,12 @@ public sealed class FileCacheManager : IHostedService
_logger.LogTrace("Updating hash for {path}", fileCache.ResolvedFilepath);
var oldHash = fileCache.Hash;
var prefixedPath = fileCache.PrefixedFilePath;
var algo = Crypto.DetectAlgo(fileCache.ResolvedFilepath);
if (computeProperties)
{
var fi = new FileInfo(fileCache.ResolvedFilepath);
fileCache.Size = fi.Length;
fileCache.CompressedSize = null;
fileCache.Hash = Crypto.ComputeFileHash(fileCache.ResolvedFilepath, algo);
fileCache.Hash = Crypto.ComputeFileHash(fileCache.ResolvedFilepath, Crypto.HashAlgo.Sha1);
fileCache.LastModifiedDateTicks = fi.LastWriteTimeUtc.Ticks.ToString(CultureInfo.InvariantCulture);
}
RemoveHashedFile(oldHash, prefixedPath);