adjust disposal behavior, recalculate cache

This commit is contained in:
rootdarkarchon
2023-03-18 11:28:00 +01:00
parent fe61b5044b
commit f8e647b242
4 changed files with 54 additions and 28 deletions

View File

@@ -242,7 +242,13 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
fi.LastWriteTime = RandomDayInThePast().Invoke();
try
{
_ = _fileDbManager.CreateCacheEntry(filePath);
var entry = _fileDbManager.CreateCacheEntry(filePath);
if (!string.Equals(entry?.Hash, file.Hash, StringComparison.OrdinalIgnoreCase))
{
Logger.LogError("Hash mismatch after extracting, got {hash}, expected {expectedHash}, deleting file", entry?.Hash, file.Hash);
File.Delete(filePath);
_fileDbManager.RemoveHash(entry);
}
}
catch (Exception ex)
{