Does this work?

This commit is contained in:
defnotken
2026-01-15 13:03:49 -06:00
parent e8c56bb3bc
commit 134268c422
3 changed files with 55 additions and 2 deletions

View File

@@ -219,4 +219,27 @@ public sealed class CachedFileProvider : IDisposable
{
return hashes.Exists(_currentTransfers.Keys.Contains);
}
public FileInfo? TryGetLocalFileInfo(string hash)
{
var fi = FilePathUtil.GetFileInfoForHash(_hotStoragePath, hash);
if (fi != null)
{
return GetLocalFilePath(hash);
}
_ = Task.Run(async () =>
{
try
{
await DownloadFileWhenRequired(hash).ConfigureAwait(false);
}
catch (Exception ex)
{
_logger.LogWarning(ex, "Download failed for {hash}", hash);
}
});
return null;
}
}