Fixed new mega links not being resolved

This commit is contained in:
erri120 2020-04-27 20:49:22 +02:00
parent a5843e12fa
commit 514d2f70fc
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135
2 changed files with 3 additions and 2 deletions

View File

@ -21,6 +21,7 @@ namespace Wabbajack.Common
public static AbsolutePath ModListDownloadFolder => "downloaded_mod_lists".RelativeTo(AbsolutePath.EntryPoint);
public static string MegaPrefix = "https://mega.nz/#!";
public static string MegaFilePrefix = "https://mega.nz/file/";
public static readonly HashSet<Extension> SupportedArchives = new[]{".zip", ".rar", ".7z", ".7zip", ".fomod", ".omod", ".exe", ".dat", ".gz", ".tar"}
.Select(s => new Extension(s)).ToHashSet();

View File

@ -77,7 +77,7 @@ namespace Wabbajack.Lib.Downloaders
public AbstractDownloadState? GetDownloaderState(string url)
{
if (url != null && url.StartsWith(Consts.MegaPrefix))
if (url != null && (url.StartsWith(Consts.MegaPrefix) || url.StartsWith(Consts.MegaFilePrefix)))
return new State(url);
return null;
}
@ -132,7 +132,7 @@ namespace Wabbajack.Lib.Downloaders
try
{
var node = await MegaApiClient.GetNodeFromLinkAsync(fileLink);
return true;
return node != null;
}
catch (Exception)
{