Replace WebUtility.UrlEncode to Uri.EscapeDataString

pull/785/head
François-Xavier Payet 3 years ago committed by Qstick
parent aa59da2f22
commit a7b1ef19f5

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Download
var encryptedLink = _protectionService.Protect(link.ToString());
var encodedLink = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(encryptedLink));
var urlEncodedFile = WebUtility.UrlEncode(file);
var urlEncodedFile = Uri.EscapeDataString(file);
var proxyLink = $"{serverUrl}{urlBase}/{indexerId}/download?apikey={_configFileProvider.ApiKey}&link={encodedLink}&file={urlEncodedFile}";
return new Uri(proxyLink);
}

@ -184,7 +184,7 @@ namespace NzbDrone.Core.Indexers.Definitions
searchString = match.Value;
}
var episodeSearchUrl = searchUrl + WebUtility.UrlEncode(searchString);
var episodeSearchUrl = searchUrl + Uri.EscapeDataString(searchString);
var request = new IndexerRequest(episodeSearchUrl, null);

@ -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, WebUtility.UrlEncode).Replace("+", "%20")).AbsoluteUri;
var searchUrl = ResolvePath(ApplyGoTemplateText(searchPath.Path, variables, Uri.EscapeDataString).Replace("+", "%20")).AbsoluteUri;
var queryCollection = new List<KeyValuePair<string, string>>();
var method = HttpMethod.Get;
@ -1038,7 +1038,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
{
if (input.Key == "$raw")
{
var rawStr = ApplyGoTemplateText(input.Value, variables, WebUtility.UrlEncode);
var rawStr = ApplyGoTemplateText(input.Value, variables, Uri.EscapeDataString);
foreach (var part in rawStr.Split('&'))
{
var parts = part.Split(new char[] { '=' }, 2);

@ -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", WebUtility.UrlEncode(term));
searchUrl += string.Format("?do=search&keywords={0}&search_type=t_name&category=0&include_dead_torrents=no", Uri.EscapeDataString(term));
}
if (categories != null && categories.Length > 0)

@ -192,7 +192,7 @@ namespace NzbDrone.Core.Indexers.Definitions
}
else if (!string.IsNullOrWhiteSpace(searchString))
{
searchUrl += "exact/1/query/" + WebUtility.UrlEncode(searchString) + "/";
searchUrl += "exact/1/query/" + Uri.EscapeDataString(searchString) + "/";
}
var cats = Capabilities.Categories.MapTorznabCapsToTrackers(categories);

Loading…
Cancel
Save