diff --git a/Wabbajack.Common/StringExtensions.cs b/Wabbajack.Common/StringExtensions.cs index 489beec2..2982bb57 100644 --- a/Wabbajack.Common/StringExtensions.cs +++ b/Wabbajack.Common/StringExtensions.cs @@ -24,4 +24,9 @@ public static class StringExtensions { return src.Contains(contains, StringComparison.InvariantCultureIgnoreCase); } + + public static string CleanIniString(this string src) + { + return src.TrimStart('\"').TrimEnd('\"'); + } } \ No newline at end of file diff --git a/Wabbajack.Downloaders.Bethesda/BethesdaDownloader.cs b/Wabbajack.Downloaders.Bethesda/BethesdaDownloader.cs index 82099a55..41425d8c 100644 --- a/Wabbajack.Downloaders.Bethesda/BethesdaDownloader.cs +++ b/Wabbajack.Downloaders.Bethesda/BethesdaDownloader.cs @@ -111,7 +111,7 @@ public class BethesdaDownloader : ADownloader, IUr public override IDownloadState? Resolve(IReadOnlyDictionary iniData) { - if (iniData.ContainsKey("directURL") && Uri.TryCreate(iniData["directURL"], UriKind.Absolute, out var uri)) + if (iniData.ContainsKey("directURL") && Uri.TryCreate(iniData["directURL"].CleanIniString(), UriKind.Absolute, out var uri)) { return Parse(uri); } diff --git a/Wabbajack.Downloaders.GoogleDrive/GoogleDriveDownloader.cs b/Wabbajack.Downloaders.GoogleDrive/GoogleDriveDownloader.cs index 30e6568e..d5af3232 100644 --- a/Wabbajack.Downloaders.GoogleDrive/GoogleDriveDownloader.cs +++ b/Wabbajack.Downloaders.GoogleDrive/GoogleDriveDownloader.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using System.Web; using HtmlAgilityPack; using Microsoft.Extensions.Logging; +using Wabbajack.Common; using Wabbajack.Downloaders.Interfaces; using Wabbajack.DTOs; using Wabbajack.DTOs.DownloadStates; @@ -67,7 +68,7 @@ public class GoogleDriveDownloader : ADownloader iniData) { - if (iniData.ContainsKey("directURL") && Uri.TryCreate(iniData["directURL"], UriKind.Absolute, out var uri)) + if (iniData.ContainsKey("directURL") && Uri.TryCreate(iniData["directURL"].CleanIniString(), UriKind.Absolute, out var uri)) return Parse(uri); return null; } diff --git a/Wabbajack.Downloaders.GoogleDrive/Wabbajack.Downloaders.GoogleDrive.csproj b/Wabbajack.Downloaders.GoogleDrive/Wabbajack.Downloaders.GoogleDrive.csproj index 9b0f1109..d5c268a7 100644 --- a/Wabbajack.Downloaders.GoogleDrive/Wabbajack.Downloaders.GoogleDrive.csproj +++ b/Wabbajack.Downloaders.GoogleDrive/Wabbajack.Downloaders.GoogleDrive.csproj @@ -13,6 +13,7 @@ + diff --git a/Wabbajack.Downloaders.Http/HttpDownloader.cs b/Wabbajack.Downloaders.Http/HttpDownloader.cs index ecda4368..28fc5ab2 100644 --- a/Wabbajack.Downloaders.Http/HttpDownloader.cs +++ b/Wabbajack.Downloaders.Http/HttpDownloader.cs @@ -53,7 +53,7 @@ public class HttpDownloader : ADownloader, IUrlDownloa public override IDownloadState? Resolve(IReadOnlyDictionary iniData) { - if (iniData.ContainsKey("directURL") && Uri.TryCreate(iniData["directURL"], UriKind.Absolute, out var uri)) + if (iniData.ContainsKey("directURL") && Uri.TryCreate(iniData["directURL"].CleanIniString(), UriKind.Absolute, out var uri)) { var state = new DTOs.DownloadStates.Http { diff --git a/Wabbajack.Downloaders.Manual/ManualDownloader.cs b/Wabbajack.Downloaders.Manual/ManualDownloader.cs index 13ce4551..a7bbede5 100644 --- a/Wabbajack.Downloaders.Manual/ManualDownloader.cs +++ b/Wabbajack.Downloaders.Manual/ManualDownloader.cs @@ -71,7 +71,7 @@ public class ManualDownloader : ADownloader, IProxya public override IDownloadState? Resolve(IReadOnlyDictionary iniData) { - if (iniData.ContainsKey("manualURL") && Uri.TryCreate(iniData["manualURL"], UriKind.Absolute, out var uri)) + if (iniData.ContainsKey("manualURL") && Uri.TryCreate(iniData["manualURL"].CleanIniString(), UriKind.Absolute, out var uri)) { iniData.TryGetValue("prompt", out var prompt); diff --git a/Wabbajack.Downloaders.MediaFire/MediaFireDownloader.cs b/Wabbajack.Downloaders.MediaFire/MediaFireDownloader.cs index a3354fad..19ee72f9 100644 --- a/Wabbajack.Downloaders.MediaFire/MediaFireDownloader.cs +++ b/Wabbajack.Downloaders.MediaFire/MediaFireDownloader.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using HtmlAgilityPack; using Microsoft.Extensions.Logging; +using Wabbajack.Common; using Wabbajack.Downloaders.Interfaces; using Wabbajack.DTOs; using Wabbajack.DTOs.DownloadStates; @@ -45,7 +46,7 @@ public class MediaFireDownloader : ADownloader, I public override IDownloadState? Resolve(IReadOnlyDictionary iniData) { if (iniData.ContainsKey("directURL") && - Uri.TryCreate(iniData["directURL"], UriKind.Absolute, out var uri) + Uri.TryCreate(iniData["directURL"].CleanIniString(), UriKind.Absolute, out var uri) && uri.Host == "www.mediafire.com") { var state = new DTOs.DownloadStates.MediaFire diff --git a/Wabbajack.Downloaders.MediaFire/Wabbajack.Downloaders.MediaFire.csproj b/Wabbajack.Downloaders.MediaFire/Wabbajack.Downloaders.MediaFire.csproj index 99c2e5f8..203d0076 100644 --- a/Wabbajack.Downloaders.MediaFire/Wabbajack.Downloaders.MediaFire.csproj +++ b/Wabbajack.Downloaders.MediaFire/Wabbajack.Downloaders.MediaFire.csproj @@ -12,6 +12,7 @@ + diff --git a/Wabbajack.Downloaders.Mega/MegaDownloader.cs b/Wabbajack.Downloaders.Mega/MegaDownloader.cs index a5ab8eaf..7782b8d1 100644 --- a/Wabbajack.Downloaders.Mega/MegaDownloader.cs +++ b/Wabbajack.Downloaders.Mega/MegaDownloader.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using CG.Web.MegaApiClient; using Microsoft.Extensions.Logging; +using Wabbajack.Common; using Wabbajack.Downloaders.Interfaces; using Wabbajack.DTOs; using Wabbajack.DTOs.DownloadStates; @@ -45,7 +46,7 @@ public class MegaDownloader : ADownloader, IUrlDownloader, IProxyable public override IDownloadState? Resolve(IReadOnlyDictionary iniData) { - return iniData.ContainsKey("directURL") ? GetDownloaderState(iniData["directURL"]) : null; + return iniData.ContainsKey("directURL") ? GetDownloaderState(iniData["directURL"].CleanIniString()) : null; } public override Priority Priority => Priority.Normal; diff --git a/Wabbajack.Downloaders.Mega/Wabbajack.Downloaders.Mega.csproj b/Wabbajack.Downloaders.Mega/Wabbajack.Downloaders.Mega.csproj index 9235eecb..3170c674 100644 --- a/Wabbajack.Downloaders.Mega/Wabbajack.Downloaders.Mega.csproj +++ b/Wabbajack.Downloaders.Mega/Wabbajack.Downloaders.Mega.csproj @@ -6,6 +6,7 @@ + diff --git a/Wabbajack.Downloaders.ModDB/ModDBDownloader.cs b/Wabbajack.Downloaders.ModDB/ModDBDownloader.cs index ce681014..971d5dd5 100644 --- a/Wabbajack.Downloaders.ModDB/ModDBDownloader.cs +++ b/Wabbajack.Downloaders.ModDB/ModDBDownloader.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using HtmlAgilityPack; using Microsoft.Extensions.Logging; +using Wabbajack.Common; using Wabbajack.Downloaders.Interfaces; using Wabbajack.DTOs; using Wabbajack.DTOs.DownloadStates; @@ -45,8 +46,8 @@ public class ModDBDownloader : ADownloader, IUrlDownl public override IDownloadState? Resolve(IReadOnlyDictionary iniData) { if (iniData.ContainsKey("directURL") && - iniData["directURL"].StartsWith("https://www.moddb.com/downloads/start") && - Uri.TryCreate(iniData["directURL"], UriKind.Absolute, out var uri)) + iniData["directURL"].CleanIniString().StartsWith("https://www.moddb.com/downloads/start") && + Uri.TryCreate(iniData["directURL"].CleanIniString().CleanIniString(), UriKind.Absolute, out var uri)) { var state = new DTOs.DownloadStates.ModDB { diff --git a/Wabbajack.Downloaders.ModDB/Wabbajack.Downloaders.ModDB.csproj b/Wabbajack.Downloaders.ModDB/Wabbajack.Downloaders.ModDB.csproj index f2edf311..f0ce6236 100644 --- a/Wabbajack.Downloaders.ModDB/Wabbajack.Downloaders.ModDB.csproj +++ b/Wabbajack.Downloaders.ModDB/Wabbajack.Downloaders.ModDB.csproj @@ -6,6 +6,7 @@ + diff --git a/Wabbajack.Downloaders.WabbajackCDN/WabbajackCDNDownloader.cs b/Wabbajack.Downloaders.WabbajackCDN/WabbajackCDNDownloader.cs index 66fa10fd..fd05e471 100644 --- a/Wabbajack.Downloaders.WabbajackCDN/WabbajackCDNDownloader.cs +++ b/Wabbajack.Downloaders.WabbajackCDN/WabbajackCDNDownloader.cs @@ -56,7 +56,7 @@ public class WabbajackCDNDownloader : ADownloader, IUrlDownloader, public override IDownloadState? Resolve(IReadOnlyDictionary iniData) { - if (iniData.ContainsKey("directURL") && Uri.TryCreate(iniData["directURL"], UriKind.Absolute, out var uri)) + if (iniData.ContainsKey("directURL") && Uri.TryCreate(iniData["directURL"].CleanIniString(), UriKind.Absolute, out var uri)) return Parse(uri); return null; }