diff --git a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabFixture.cs index 1e1e2f53a..d31be4c1a 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabFixture.cs @@ -62,13 +62,21 @@ public void should_parse_recent_feed_from_newznab_nzb_su() releaseInfo.Size.Should().Be(1183105773); } - [Test] - public void should_use_pagesize_reported_by_caps() + public void should_use_best_pagesize_reported_by_caps() { _caps.MaxPageSize = 30; _caps.DefaultPageSize = 25; - Subject.PageSize.Should().Be(25); + Subject.PageSize.Should().Be(30); + } + + [Test] + public void should_not_use_pagesize_over_100_even_if_reported_in_caps() + { + _caps.MaxPageSize = 250; + _caps.DefaultPageSize = 25; + + Subject.PageSize.Should().Be(100); } } } diff --git a/src/NzbDrone.Core.Test/IndexerTests/TorznabTests/TorznabFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/TorznabTests/TorznabFixture.cs index 451e4e5fc..8fb66a334 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TorznabTests/TorznabFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TorznabTests/TorznabFixture.cs @@ -135,12 +135,21 @@ public void should_parse_recent_feed_from_torznab_animetosho() } [Test] - public void should_use_pagesize_reported_by_caps() + public void should_use_best_pagesize_reported_by_caps() { _caps.MaxPageSize = 30; _caps.DefaultPageSize = 25; - Subject.PageSize.Should().Be(25); + Subject.PageSize.Should().Be(30); + } + + [Test] + public void should_not_use_pagesize_over_100_even_if_reported_in_caps() + { + _caps.MaxPageSize = 250; + _caps.DefaultPageSize = 25; + + Subject.PageSize.Should().Be(100); } [TestCase("http://localhost:9117/", "/api")] diff --git a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs index 4252a4eba..73ecfb96b 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs @@ -20,7 +20,7 @@ public class Newznab : HttpIndexerBase public override DownloadProtocol Protocol => DownloadProtocol.Usenet; - public override int PageSize => _capabilitiesProvider.GetCapabilities(Settings).DefaultPageSize; + public override int PageSize => Math.Min(100, Math.Max(_capabilitiesProvider.GetCapabilities(Settings).DefaultPageSize, _capabilitiesProvider.GetCapabilities(Settings).MaxPageSize)); public override IIndexerRequestGenerator GetRequestGenerator() { diff --git a/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs b/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs index ff9c222f3..95b21c20b 100644 --- a/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs +++ b/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs @@ -20,7 +20,7 @@ public class Torznab : HttpIndexerBase public override string Name => "Torznab"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; - public override int PageSize => _capabilitiesProvider.GetCapabilities(Settings).DefaultPageSize; + public override int PageSize => Math.Min(100, Math.Max(_capabilitiesProvider.GetCapabilities(Settings).DefaultPageSize, _capabilitiesProvider.GetCapabilities(Settings).MaxPageSize)); public override IIndexerRequestGenerator GetRequestGenerator() {