Fix LL downloads via HTML decode 2.2.1.6

This commit is contained in:
halgari 2020-08-24 16:20:50 -06:00
parent babb7b07dc
commit 573e661b03
8 changed files with 45 additions and 23 deletions

View File

@ -1,5 +1,11 @@
### Changelog
#### Version - 2.2.1.6 - 8/21/2020
* HOTFIX - Make LoversLab auto-update work again
#### Version - 2.2.1.5 - 8/21/2020
* HOTFIX - Fix for broken patching in RGE and other lists
#### Version - 2.2.1.4 - 8/21/2020
* HOTFIX - No really...stop doing that

View File

@ -6,8 +6,8 @@
<AssemblyName>wabbajack-cli</AssemblyName>
<Company>Wabbajack</Company>
<Platforms>x64</Platforms>
<AssemblyVersion>2.2.1.5</AssemblyVersion>
<FileVersion>2.2.1.5</FileVersion>
<AssemblyVersion>2.2.1.6</AssemblyVersion>
<FileVersion>2.2.1.6</FileVersion>
<Copyright>Copyright © 2019-2020</Copyright>
<Description>An automated ModList installer</Description>
<PublishReadyToRun>true</PublishReadyToRun>

View File

@ -4,8 +4,8 @@
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyVersion>2.2.1.5</AssemblyVersion>
<FileVersion>2.2.1.5</FileVersion>
<AssemblyVersion>2.2.1.6</AssemblyVersion>
<FileVersion>2.2.1.6</FileVersion>
<Copyright>Copyright © 2019-2020</Copyright>
<Description>Wabbajack Application Launcher</Description>
<PublishReadyToRun>true</PublishReadyToRun>

View File

@ -122,7 +122,7 @@ namespace Wabbajack.Lib.Downloaders
{
get
{
return FileID == null
return string.IsNullOrWhiteSpace(FileID)
? IsAttachment
? new object[] {Downloader.SiteURL, IsAttachment, FullURL}
: new object[] {Downloader.SiteURL, FileName}
@ -240,22 +240,23 @@ namespace Wabbajack.Lib.Downloaders
{
var files = await GetFilesInGroup();
var nl = new Levenshtein();
var newFile = files.OrderBy(f => nl.Distance(a.Name.ToLowerInvariant(), f.Name.ToLowerInvariant())).FirstOrDefault();
if (newFile == null) return default;
var existing = await downloadResolver(newFile);
if (existing != default) return (newFile, new TempFile());
var tmp = new TempFile();
await DownloadDispatcher.PrepareAll(new []{newFile.State});
if (await newFile.State.Download(newFile, tmp.Path))
foreach (var newFile in files.OrderBy(f => nl.Distance(a.Name.ToLowerInvariant(), f.Name.ToLowerInvariant())))
{
newFile.Size = tmp.Path.Size;
newFile.Hash = await tmp.Path.FileHashAsync();
return (newFile, tmp);
}
var existing = await downloadResolver(newFile);
if (existing != default) return (newFile, new TempFile());
await tmp.DisposeAsync();
var tmp = new TempFile();
await DownloadDispatcher.PrepareAll(new[] {newFile.State});
if (await newFile.State.Download(newFile, tmp.Path))
{
newFile.Size = tmp.Path.Size;
newFile.Hash = await tmp.Path.FileHashAsync();
return (newFile, tmp);
}
await tmp.DisposeAsync();
}
return default;
}
@ -271,7 +272,8 @@ namespace Wabbajack.Lib.Downloaders
List<Archive> archives = new List<Archive>();
foreach (var (url, name) in pairs)
{
var ini = new[] {"[General]", $"directURL={url}"};
var urlDecoded = HttpUtility.HtmlDecode(url);
var ini = new[] {"[General]", $"directURL={urlDecoded}"};
var state = (AbstractDownloadState)(await DownloadDispatcher.ResolveArchive(
string.Join("\n", ini).LoadIniString(), false));
if (state == null) continue;

View File

@ -240,6 +240,12 @@ namespace Wabbajack.Server.Services
return (archive, ArchiveStatus.InValid);
}
if (destDownload.Archive.Hash == default)
{
_logger.Log(LogLevel.Information, "Can't heal because we got back a default hash for the downloaded file");
return (archive, ArchiveStatus.InValid);
}
var existing = await _sql.FindPatch(srcDownload.Id, destDownload.Id);
if (existing == null)

View File

@ -3,8 +3,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyVersion>2.2.1.5</AssemblyVersion>
<FileVersion>2.2.1.5</FileVersion>
<AssemblyVersion>2.2.1.6</AssemblyVersion>
<FileVersion>2.2.1.6</FileVersion>
<Copyright>Copyright © 2019-2020</Copyright>
<Description>Wabbajack Server</Description>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

View File

@ -313,12 +313,20 @@ namespace Wabbajack.Test
Assert.NotEmpty(files);
Assert.Equal("WABBAJACK_TEST_FILE.zip", files.First().Name);
Assert.True(files.All(f => !string.IsNullOrWhiteSpace(((LoversLabDownloader.State)f.State).FileID)));
((LoversLabDownloader.State)converted).FileID = "42";
var upgrade = await DownloadDispatcher.FindUpgrade(new Archive(converted) {Name = "WABBAJACK_TEST_FILE.zip"});
Assert.True(upgrade != default);
var newState = ((LoversLabDownloader.State)upgrade.Archive.State);
Assert.False(string.IsNullOrWhiteSpace(newState.FileID));
var roundTripped = newState.ViaJSON();
Assert.False(string.IsNullOrWhiteSpace(roundTripped.FileID));
}

View File

@ -6,8 +6,8 @@
<UseWPF>true</UseWPF>
<Platforms>x64</Platforms>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<AssemblyVersion>2.2.1.5</AssemblyVersion>
<FileVersion>2.2.1.5</FileVersion>
<AssemblyVersion>2.2.1.6</AssemblyVersion>
<FileVersion>2.2.1.6</FileVersion>
<Copyright>Copyright © 2019-2020</Copyright>
<Description>An automated ModList installer</Description>
<PublishReadyToRun>true</PublishReadyToRun>