From 5b5c186d0ce640d1c3dd829b4f7ca153faa81943 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 23 Jan 2022 19:34:59 -0600 Subject: [PATCH] Revert "Replace WebUtility.UrlEncode to Uri.EscapeDataString " This reverts commit a7b1ef19f57b8182c2ec3b105fe17d770add33d3. --- src/NzbDrone.Core/Download/DownloadMappingService.cs | 2 +- src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs | 2 +- .../Definitions/Cardigann/CardigannRequestGenerator.cs | 4 ++-- src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs | 2 +- src/NzbDrone.Core/Indexers/Definitions/TorrentLeech.cs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Core/Download/DownloadMappingService.cs b/src/NzbDrone.Core/Download/DownloadMappingService.cs index 812087c47..a3dbcc539 100644 --- a/src/NzbDrone.Core/Download/DownloadMappingService.cs +++ b/src/NzbDrone.Core/Download/DownloadMappingService.cs @@ -36,7 +36,7 @@ namespace NzbDrone.Core.Download var encryptedLink = _protectionService.Protect(link.ToString()); var encodedLink = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(encryptedLink)); - var urlEncodedFile = Uri.EscapeDataString(file); + var urlEncodedFile = WebUtility.UrlEncode(file); var proxyLink = $"{serverUrl}{urlBase}/{indexerId}/download?apikey={_configFileProvider.ApiKey}&link={encodedLink}&file={urlEncodedFile}"; return new Uri(proxyLink); } diff --git a/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs b/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs index 20824838d..8595a16d1 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs @@ -184,7 +184,7 @@ namespace NzbDrone.Core.Indexers.Definitions searchString = match.Value; } - var episodeSearchUrl = searchUrl + Uri.EscapeDataString(searchString); + var episodeSearchUrl = searchUrl + WebUtility.UrlEncode(searchString); var request = new IndexerRequest(episodeSearchUrl, null); diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs index 0ca06a2d4..2622142cd 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs @@ -1013,7 +1013,7 @@ namespace NzbDrone.Core.Indexers.Cardigann // build search URL // HttpUtility.UrlPathEncode seems to only encode spaces, we use UrlEncode and replace + with %20 as a workaround - var searchUrl = ResolvePath(ApplyGoTemplateText(searchPath.Path, variables, Uri.EscapeDataString).Replace("+", "%20")).AbsoluteUri; + var searchUrl = ResolvePath(ApplyGoTemplateText(searchPath.Path, variables, WebUtility.UrlEncode).Replace("+", "%20")).AbsoluteUri; var queryCollection = new List>(); var method = HttpMethod.Get; @@ -1038,7 +1038,7 @@ namespace NzbDrone.Core.Indexers.Cardigann { if (input.Key == "$raw") { - var rawStr = ApplyGoTemplateText(input.Value, variables, Uri.EscapeDataString); + var rawStr = ApplyGoTemplateText(input.Value, variables, WebUtility.UrlEncode); foreach (var part in rawStr.Split('&')) { var parts = part.Split(new char[] { '=' }, 2); diff --git a/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs b/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs index c8a8cb0ab..59d3bb07d 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs @@ -174,7 +174,7 @@ namespace NzbDrone.Core.Indexers.Definitions if (term.IsNotNullOrWhiteSpace()) { - searchUrl += string.Format("?do=search&keywords={0}&search_type=t_name&category=0&include_dead_torrents=no", Uri.EscapeDataString(term)); + searchUrl += string.Format("?do=search&keywords={0}&search_type=t_name&category=0&include_dead_torrents=no", WebUtility.UrlEncode(term)); } if (categories != null && categories.Length > 0) diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentLeech.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentLeech.cs index 8da22b1a8..065ab7481 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentLeech.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentLeech.cs @@ -192,7 +192,7 @@ namespace NzbDrone.Core.Indexers.Definitions } else if (!string.IsNullOrWhiteSpace(searchString)) { - searchUrl += "exact/1/query/" + Uri.EscapeDataString(searchString) + "/"; + searchUrl += "exact/1/query/" + WebUtility.UrlEncode(searchString) + "/"; } var cats = Capabilities.Categories.MapTorznabCapsToTrackers(categories);