From 844ee9ed3aff344fa5d271b8af0ecf7f3147faae Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Fri, 22 May 2020 14:56:58 -0600 Subject: [PATCH 1/3] Fix manual download regression --- CHANGELOG.md | 3 +++ Wabbajack.Common.Test/HttpClientTests.cs | 6 +++--- Wabbajack.Lib/FileUploader/AuthorAPI.cs | 4 ++-- Wabbajack.Lib/NexusApi/NexusApi.cs | 7 ++++--- Wabbajack.Server/Services/ListValidator.cs | 4 ++-- Wabbajack.Server/Services/PatchBuilder.cs | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fa152cc..00715e3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Wabbajack.Common.Test/HttpClientTests.cs b/Wabbajack.Common.Test/HttpClientTests.cs index aa33c8fe..a6366cc7 100644 --- a/Wabbajack.Common.Test/HttpClientTests.cs +++ b/Wabbajack.Common.Test/HttpClientTests.cs @@ -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(async () => await client.GetAsync("http://blerg.blaz.bloz.buz")); + await Assert.ThrowsAsync(async () => await client.GetAsync("http://blerg.blaz.bloz.buz")); } } } diff --git a/Wabbajack.Lib/FileUploader/AuthorAPI.cs b/Wabbajack.Lib/FileUploader/AuthorAPI.cs index e2b36c0e..221555f0 100644 --- a/Wabbajack.Lib/FileUploader/AuthorAPI.cs +++ b/Wabbajack.Lib/FileUploader/AuthorAPI.cs @@ -56,7 +56,7 @@ namespace Wabbajack.Lib.FileUploader public static async Task UploadPackagedInis(IEnumerable 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); } } diff --git a/Wabbajack.Lib/NexusApi/NexusApi.cs b/Wabbajack.Lib/NexusApi/NexusApi.cs index 266c9bb0..e6b64131 100644 --- a/Wabbajack.Lib/NexusApi/NexusApi.cs +++ b/Wabbajack.Lib/NexusApi/NexusApi.cs @@ -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>(url)).First().URI; } - catch (HttpRequestException) + catch (HttpException ex) { - if (await IsPremium()) + if (ex.Code != 403 || await IsPremium()) { throw; } diff --git a/Wabbajack.Server/Services/ListValidator.cs b/Wabbajack.Server/Services/ListValidator.cs index 4ac633b2..1bc68c28 100644 --- a/Wabbajack.Server/Services/ListValidator.cs +++ b/Wabbajack.Server/Services/ListValidator.cs @@ -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); } diff --git a/Wabbajack.Server/Services/PatchBuilder.cs b/Wabbajack.Server/Services/PatchBuilder.cs index c36a679d..f7e95817 100644 --- a/Wabbajack.Server/Services/PatchBuilder.cs +++ b/Wabbajack.Server/Services/PatchBuilder.cs @@ -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 = From 40592d72c9eeaa90746568a3ea0c5b72241f418e Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Fri, 22 May 2020 14:57:38 -0600 Subject: [PATCH 2/3] Version bump --- Wabbajack.CLI/Wabbajack.CLI.csproj | 4 ++-- Wabbajack.Launcher/Wabbajack.Launcher.csproj | 4 ++-- Wabbajack.Server/Wabbajack.Server.csproj | 4 ++-- Wabbajack/Wabbajack.csproj | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Wabbajack.CLI/Wabbajack.CLI.csproj b/Wabbajack.CLI/Wabbajack.CLI.csproj index 1acd4cb8..3337797b 100644 --- a/Wabbajack.CLI/Wabbajack.CLI.csproj +++ b/Wabbajack.CLI/Wabbajack.CLI.csproj @@ -6,8 +6,8 @@ wabbajack-cli Wabbajack x64 - 2.0.6.0 - 2.0.6.0 + 2.0.6.1 + 2.0.6.1 Copyright © 2019-2020 An automated ModList installer true diff --git a/Wabbajack.Launcher/Wabbajack.Launcher.csproj b/Wabbajack.Launcher/Wabbajack.Launcher.csproj index 14621139..9ef35638 100644 --- a/Wabbajack.Launcher/Wabbajack.Launcher.csproj +++ b/Wabbajack.Launcher/Wabbajack.Launcher.csproj @@ -4,8 +4,8 @@ WinExe netcoreapp3.1 true - 2.0.6.0 - 2.0.6.0 + 2.0.6.1 + 2.0.6.1 Copyright © 2019-2020 Wabbajack Application Launcher true diff --git a/Wabbajack.Server/Wabbajack.Server.csproj b/Wabbajack.Server/Wabbajack.Server.csproj index 6ef5d71d..257ad08b 100644 --- a/Wabbajack.Server/Wabbajack.Server.csproj +++ b/Wabbajack.Server/Wabbajack.Server.csproj @@ -3,8 +3,8 @@ Exe netcoreapp3.1 - 2.0.6.0 - 2.0.6.0 + 2.0.6.1 + 2.0.6.1 Copyright © 2019-2020 Wabbajack Server win-x64 diff --git a/Wabbajack/Wabbajack.csproj b/Wabbajack/Wabbajack.csproj index c1784157..52b584f7 100644 --- a/Wabbajack/Wabbajack.csproj +++ b/Wabbajack/Wabbajack.csproj @@ -6,8 +6,8 @@ true x64 win10-x64 - 2.0.6.0 - 2.0.6.0 + 2.0.6.1 + 2.0.6.1 Copyright © 2019-2020 An automated ModList installer true From 3e935d2e6c338c0db6b0153a7b77b3806e2ea02a Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Fri, 22 May 2020 15:52:05 -0600 Subject: [PATCH 3/3] Don't really need that test anymore --- Wabbajack.Common.Test/HttpClientTests.cs | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 Wabbajack.Common.Test/HttpClientTests.cs diff --git a/Wabbajack.Common.Test/HttpClientTests.cs b/Wabbajack.Common.Test/HttpClientTests.cs deleted file mode 100644 index a6366cc7..00000000 --- a/Wabbajack.Common.Test/HttpClientTests.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Threading.Tasks; -using Wabbajack.Common.Exceptions; -using Xunit; - -namespace Wabbajack.Common.Test -{ - public class HttpClientTests - { - [Fact] - public async Task DoesntReuseHttpMessages() - { - var client = new Common.Http.Client(); - // If we reuse the HTTP message this will throw a invalid operation exception - await Assert.ThrowsAsync(async () => await client.GetAsync("http://blerg.blaz.bloz.buz")); - } - } -}