Fix manual download regression

This commit is contained in:
Timothy Baldridge 2020-05-22 14:56:58 -06:00
parent 8c4a1dd125
commit 844ee9ed3a
6 changed files with 15 additions and 11 deletions

View File

@ -1,5 +1,8 @@
### Changelog
#### Version - 2.0.6.1 - 5/22/2020
* Fix regression with manual archive downloading
#### Version - 2.0.6.0 - 5/21/2020
* Add auto-healing features back into the client/server code
* Put in the code about "Hashing Archives" that somehow missed the last release

View File

@ -1,5 +1,5 @@
using System.Net.Http;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Wabbajack.Common.Exceptions;
using Xunit;
namespace Wabbajack.Common.Test
@ -11,7 +11,7 @@ namespace Wabbajack.Common.Test
{
var client = new Common.Http.Client();
// If we reuse the HTTP message this will throw a invalid operation exception
await Assert.ThrowsAsync<HttpRequestException>(async () => await client.GetAsync("http://blerg.blaz.bloz.buz"));
await Assert.ThrowsAsync<HttpException>(async () => await client.GetAsync("http://blerg.blaz.bloz.buz"));
}
}
}

View File

@ -56,7 +56,7 @@ namespace Wabbajack.Lib.FileUploader
public static async Task<bool> UploadPackagedInis(IEnumerable<Archive> archives)
{
archives = archives.ToArray(); // defensive copy
Utils.Log($"Packaging {archives.Count()} inis");
Utils.Log($"Packaging {archives.Count()} archive states");
try
{
await using var ms = new MemoryStream();
@ -67,7 +67,7 @@ namespace Wabbajack.Lib.FileUploader
if (e.State == null) continue;
var entry = z.CreateEntry(Path.GetFileName(e.Name));
await using var os = entry.Open();
await os.WriteAsync(Encoding.UTF8.GetBytes(string.Join("\n", e.State.GetMetaIni())));
e.ToJson(os);
}
}

View File

@ -10,6 +10,7 @@ using System.Threading.Tasks;
using Wabbajack.Common;
using Wabbajack.Lib.Downloaders;
using System.Threading;
using Wabbajack.Common.Exceptions;
using Wabbajack.Lib.WebAutomation;
namespace Wabbajack.Lib.NexusApi
@ -267,7 +268,7 @@ namespace Wabbajack.Lib.NexusApi
if (!response.IsSuccessStatusCode)
{
Utils.Log($"Nexus call failed: {response.RequestMessage.RequestUri}");
throw new HttpRequestException($"{response.StatusCode} - {response.ReasonPhrase}");
throw new HttpException(response);
}
@ -317,9 +318,9 @@ namespace Wabbajack.Lib.NexusApi
{
return (await Get<List<DownloadLink>>(url)).First().URI;
}
catch (HttpRequestException)
catch (HttpException ex)
{
if (await IsPremium())
if (ex.Code != 403 || await IsPremium())
{
throw;
}

View File

@ -109,7 +109,7 @@ namespace Wabbajack.Server.Services
});
}
if (!summary.HasFailures)
if (!summary.HasFailures && oldSummary.Summary.HasFailures)
{
await _discord.Send(Channel.Ham,
new DiscordMessage
@ -146,7 +146,7 @@ namespace Wabbajack.Server.Services
var srcDownload = await _sql.GetArchiveDownload(archive.State.PrimaryKeyString, archive.Hash, archive.Size);
if (srcDownload == null || srcDownload.IsFailed == true)
{
_logger.Log(LogLevel.Information, $"Cannot heal {archive.State.PrimaryKeyString} because it hasn't been previously successfully downloaded");
_logger.Log(LogLevel.Information, $"Cannot heal {archive.State.PrimaryKeyString} Size: {archive.Size} Hash: {(long)archive.Hash} because it hasn't been previously successfully downloaded");
return (archive, ArchiveStatus.InValid);
}

View File

@ -67,7 +67,7 @@ namespace Wabbajack.Server.Services
await patch.Finish(_sql, size);
await _discordWebHook.Send(Channel.Ham,
await _discordWebHook.Send(Channel.Spam,
new DiscordMessage
{
Content =