BSA fix, better logging for failed IPS4 downloads

This commit is contained in:
halgari 2020-08-24 19:34:57 -06:00
parent 573e661b03
commit 496a35a605
7 changed files with 27 additions and 6 deletions

View File

@ -2,6 +2,7 @@
#### Version - 2.2.1.6 - 8/21/2020
* HOTFIX - Make LoversLab auto-update work again
* HOTFIX - Fix for "End of Stream before End of Limit" symptom on BSA extraction
#### Version - 2.2.1.5 - 8/21/2020
* HOTFIX - Fix for broken patching in RGE and other lists

View File

@ -72,6 +72,7 @@ namespace Compression.BSA.Test
[InlineData(Game.SkyrimSpecialEdition, 12604)] // SkyUI
[InlineData(Game.Skyrim, 3863)] // SkyUI
[InlineData(Game.Skyrim, 51473)] // INeed
[InlineData(Game.Skyrim, 41634)] // DVA
[InlineData(Game.Fallout4, 22223)] // 10mm SMG
[InlineData(Game.Fallout4, 4472)] // True Storms
[InlineData(Game.Morrowind, 44537)]

View File

@ -129,6 +129,8 @@ namespace Compression.BSA
nameBlobOffset = rdr.ReadByte();
// Just skip, not using
rdr.BaseStream.Position += nameBlobOffset;
// Minus one more for the size of the name blob offset size
nameBlobOffset++;
}
else
{

View File

@ -1030,6 +1030,7 @@ namespace Wabbajack.Common
public static async Task CopyToLimitAsync(this Stream frm, Stream tw, long limit)
{
var buff = new byte[1024];
var initalLimit = limit;
while (limit > 0)
{
var to_read = Math.Min(buff.Length, limit);

View File

@ -155,7 +155,7 @@ namespace Wabbajack.Lib.Downloaders
}
else
{
var csrfURL = FileID == null
var csrfURL = string.IsNullOrWhiteSpace(FileID)
? $"{Site}/files/file/{FileName}/?do=download"
: $"{Site}/files/file/{FileName}/?do=download&r={FileID}";
var html = await Downloader.AuthedClient.GetStringAsync(csrfURL);
@ -166,7 +166,10 @@ namespace Wabbajack.Lib.Downloaders
var csrfKey = matches.Where(m => m.Length == 32).Select(m => m.ToString()).FirstOrDefault();
if (csrfKey == null)
{
Utils.Log($"Returning null from IPS4 Downloader because no csrfKey was found");
return null;
}
var sep = Site.EndsWith("?") ? "&" : "?";
url = FileID == null
@ -193,10 +196,12 @@ namespace Wabbajack.Lib.Downloaders
long.TryParse(headerVar, out headerContentSize);
}
if (a.Size != 0 && headerContentSize != 0 && a.Size != headerContentSize)
if (a.Size != 0 && headerContentSize != 0 && a.Size != headerContentSize)
{
Utils.Log($"Bad Header Content sizes {a.Size} vs {headerContentSize}");
return null;
}
return streamResult;
}
@ -261,6 +266,11 @@ namespace Wabbajack.Lib.Downloaders
}
public override async Task<bool> ValidateUpgrade(Hash srcHash, AbstractDownloadState newArchiveState)
{
return !string.IsNullOrWhiteSpace(FileID);
}
public async Task<List<Archive>> GetFilesInGroup()
{
var others = await Downloader.AuthedClient.GetHtmlAsync($"{Site}/files/file/{FileName}?do=download");

View File

@ -207,7 +207,8 @@ namespace Wabbajack.Server.DataLayer
return (await conn.QueryAsync<(Hash, Hash)>(@"SELECT a1.Hash, a2.Hash
FROM dbo.Patches p
LEFT JOIN dbo.ArchiveDownloads a1 ON a1.Id = p.SrcId
LEFT JOIN dbo.ArchiveDownloads a2 on a2.Id = p.DestId")).ToHashSet();
LEFT JOIN dbo.ArchiveDownloads a2 on a2.Id = p.DestId
WHERE p.Finished IS NOT NULL")).ToHashSet();
}
public async Task DeletePatchesForHashPair((Hash, Hash) sqlFile)

View File

@ -68,7 +68,12 @@ namespace Wabbajack.Server.Services
await DownloadDispatcher.PrepareAll(new[] {nextDownload.Archive.State});
await using var tempPath = new TempFile();
await nextDownload.Archive.State.Download(nextDownload.Archive, tempPath.Path);
if (!await nextDownload.Archive.State.Download(nextDownload.Archive, tempPath.Path))
{
_logger.LogError($"Downloader returned false for {nextDownload.Archive.State.PrimaryKeyString}");
await nextDownload.Fail(_sql, "Downloader returned false");
continue;
}
var hash = await tempPath.Path.FileHashAsync();