mirror of
https://github.com/Readarr/Readarr
synced 2025-12-30 04:06:53 +01:00
Fixed: Escape Characters as needed for *znab queries
(cherry picked from commit f678775e5c3deb0c520f88a137198331fee2831f)
This commit is contained in:
parent
b27f852154
commit
96aeb022ab
2 changed files with 38 additions and 1 deletions
|
|
@ -62,5 +62,40 @@ public void should_search_by_author_and_book_if_supported()
|
|||
page.Url.Query.Should().Contain("author=Alien%20Ant%20Farm");
|
||||
page.Url.Query.Should().Contain("title=TruANT");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_encode_raw_title()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "season", "ep" };
|
||||
_capabilities.TvTextSearchEngine = "raw";
|
||||
_singleEpisodeSearchCriteria.SceneTitles[0] = "Edith & Little";
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
results.Tiers.Should().Be(1);
|
||||
|
||||
var pageTier = results.GetTier(0).First().First();
|
||||
|
||||
pageTier.Url.Query.Should().Contain("q=Edith%20%26%20Little");
|
||||
pageTier.Url.Query.Should().NotContain(" & ");
|
||||
pageTier.Url.Query.Should().Contain("%26");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_clean_title_and_encode()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "season", "ep" };
|
||||
_capabilities.TvTextSearchEngine = "sphinx";
|
||||
_singleEpisodeSearchCriteria.SceneTitles[0] = "Edith & Little";
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
results.Tiers.Should().Be(1);
|
||||
|
||||
var pageTier = results.GetTier(0).First().First();
|
||||
|
||||
pageTier.Url.Query.Should().Contain("q=Edith%20and%20Little");
|
||||
pageTier.Url.Query.Should().Contain("and");
|
||||
pageTier.Url.Query.Should().NotContain(" & ");
|
||||
pageTier.Url.Query.Should().NotContain("%26");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
|
@ -145,7 +146,8 @@ private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, IEnumerable<i
|
|||
|
||||
private static string NewsnabifyTitle(string title)
|
||||
{
|
||||
return title.Replace("+", "%20");
|
||||
title = title.Replace("+", " ");
|
||||
return Uri.EscapeDataString(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue