Escape search query and use string interpolation for Headphones request generation

pull/3612/head
Bogdan 2 years ago
parent 5ce376d314
commit 8368a8021d

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
@ -39,7 +40,7 @@ namespace NzbDrone.Core.Indexers.Headphones
pageableRequests.Add(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
Settings.Categories, Settings.Categories,
"search", "search",
NewsnabifyTitle($"&q={searchCriteria.CleanArtistQuery}+{searchCriteria.CleanAlbumQuery}"))); $"&q={NewsnabifyTitle(searchCriteria.CleanArtistQuery)}+{NewsnabifyTitle(searchCriteria.CleanAlbumQuery)}"));
return pageableRequests; return pageableRequests;
} }
@ -53,7 +54,7 @@ namespace NzbDrone.Core.Indexers.Headphones
pageableRequests.Add(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
Settings.Categories, Settings.Categories,
"search", "search",
NewsnabifyTitle($"&q={searchCriteria.CleanArtistQuery}"))); $"&q={NewsnabifyTitle(searchCriteria.CleanArtistQuery)}"));
return pageableRequests; return pageableRequests;
} }
@ -96,7 +97,8 @@ namespace NzbDrone.Core.Indexers.Headphones
private static string NewsnabifyTitle(string title) private static string NewsnabifyTitle(string title)
{ {
return title.Replace("+", "%20"); title = title.Replace("+", " ");
return Uri.EscapeDataString(title);
} }
} }
} }

Loading…
Cancel
Save