mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Forced healing works!
This commit is contained in:
parent
87093a1149
commit
becabefd8c
@ -123,13 +123,13 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
return DownloadResult.Failure;
|
return DownloadResult.Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replacementMeta.Status == ArchiveStatus.Mirrored && await DownloadFromMirror(replacementMeta.PatchedFrom!, destination))
|
if (replacementMeta.Status == ArchiveStatus.Mirrored && await Download(replacementMeta.PatchedFrom!, destination))
|
||||||
{
|
{
|
||||||
await destination.FileHashCachedAsync();
|
await destination.FileHashCachedAsync();
|
||||||
return DownloadResult.Mirror;
|
return DownloadResult.Mirror;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replacementMeta.Status != ArchiveStatus.Updated || !(archive.State is IUpgradingState))
|
if (replacementMeta.Status != ArchiveStatus.Updated)
|
||||||
{
|
{
|
||||||
Utils.Log($"Download failed for {archive.Name} and no upgrade from this download source is possible");
|
Utils.Log($"Download failed for {archive.Name} and no upgrade from this download source is possible");
|
||||||
return DownloadResult.Failure;
|
return DownloadResult.Failure;
|
||||||
@ -172,28 +172,6 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
return await a.State.FindUpgrade(a, downloadResolver);
|
return await a.State.FindUpgrade(a, downloadResolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static async Task<bool> DownloadFromMirror(Archive archive, AbsolutePath destination)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var url = await ClientAPI.GetMirrorUrl(archive.Hash);
|
|
||||||
if (url == null) return false;
|
|
||||||
|
|
||||||
var newArchive =
|
|
||||||
new Archive(
|
|
||||||
new WabbajackCDNDownloader.State(url))
|
|
||||||
{
|
|
||||||
Hash = archive.Hash, Size = archive.Size, Name = archive.Name
|
|
||||||
};
|
|
||||||
return await Download(newArchive, destination);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<bool> Download(Archive archive, AbsolutePath destination)
|
private static async Task<bool> Download(Archive archive, AbsolutePath destination)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -58,7 +58,7 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
if (ms.Length != part.Size)
|
if (ms.Length != part.Size)
|
||||||
return BadRequest($"Couldn't read enough data for part {part.Size} vs {ms.Length}");
|
return BadRequest($"Couldn't read enough data for part {part.Size} vs {ms.Length}");
|
||||||
|
|
||||||
var hash = ms.xxHash();
|
var hash = await ms.xxHashAsync();
|
||||||
if (hash != part.Hash)
|
if (hash != part.Hash)
|
||||||
return BadRequest($"Hashes don't match for index {index}. Sizes ({ms.Length} vs {part.Size}). Hashes ({hash} vs {part.Hash}");
|
return BadRequest($"Hashes don't match for index {index}. Sizes ({ms.Length} vs {part.Size}). Hashes ({hash} vs {part.Hash}");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user