mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #1396 from LostDragonist/ld_fixes
Use a different Google Drive link to verify links during compile
This commit is contained in:
commit
d22ab2e97d
@ -56,13 +56,15 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
public override async Task<bool> Download(Archive a, AbsolutePath destination)
|
||||
{
|
||||
var state = await ToHttpState();
|
||||
var state = await ToHttpState(download: true);
|
||||
if (state == null)
|
||||
return false;
|
||||
return await state.Download(a, destination);
|
||||
}
|
||||
|
||||
private async Task<HTTPDownloader.State?> ToHttpState()
|
||||
private async Task<HTTPDownloader.State?> ToHttpState(bool download)
|
||||
{
|
||||
if (download)
|
||||
{
|
||||
var initialURL = $"https://drive.google.com/uc?id={Id}&export=download";
|
||||
var client = new Wabbajack.Lib.Http.Client();
|
||||
@ -81,10 +83,21 @@ namespace Wabbajack.Lib.Downloaders
|
||||
var httpState = new HTTPDownloader.State(url) { Client = client };
|
||||
return httpState;
|
||||
}
|
||||
else
|
||||
{
|
||||
var url = $"https://drive.google.com/file/d/{Id}/edit";
|
||||
var client = new Wabbajack.Lib.Http.Client();
|
||||
using var response = await client.GetAsync(url, errorsAsExceptions: false);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
throw new HttpException((int)response.StatusCode, response.ReasonPhrase ?? "Unknown");
|
||||
var httpState = new HTTPDownloader.State(url) { Client = client };
|
||||
return httpState;
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<bool> Verify(Archive a, CancellationToken? token)
|
||||
{
|
||||
var state = await ToHttpState();
|
||||
var state = await ToHttpState(download: false);
|
||||
if (state == null)
|
||||
return false;
|
||||
return await state.Verify(a, token);
|
||||
|
Loading…
Reference in New Issue
Block a user