Fixed: Don't send limit=0 to Newznab indexers (#2654)

* Fixed: Don't send limit=0 to Newznab indexers

When searching via the internal API, SearchResource.Limit defaults
to 0 because it's a non-nullable int. This gets passed through to
the Newznab request generator, which emits &limit=0 in the query URL.

Indexers that follow the Newznab spec honor limit=0 literally and
return zero results. Confirmed affected: DrunkenSlug and NZBGeek.

Changed Limit and Offset on SearchResource to int? so they default
to null when omitted, matching the existing behavior in NewznabRequest.
Also guard against emitting limit=0 in the request
generators.

Co-authored-by: Daniel Jacobs <danielj@certida.com>
Co-authored-by: Bogdan <mynameisbogdan@users.noreply.github.com>
This commit is contained in:
Daniel Jacobs
2026-04-11 10:18:29 +01:00
committed by GitHub
parent b2d49164bc
commit c687bdb1fb
3 changed files with 4 additions and 4 deletions

View File

@@ -120,7 +120,7 @@ namespace NzbDrone.Core.Indexers.Headphones
baseUrl += "&apikey=" + Settings.ApiKey;
}
if (searchCriteria.Limit.HasValue)
if (searchCriteria.Limit is > 0)
{
parameters.Add("limit", searchCriteria.Limit.ToString());
}

View File

@@ -263,7 +263,7 @@ namespace NzbDrone.Core.Indexers.Newznab
searchUrl += "&apikey=" + Settings.ApiKey;
}
if (searchCriteria.Limit.HasValue)
if (searchCriteria.Limit is > 0)
{
parameters.Set("limit", searchCriteria.Limit.ToString());
}

View File

@@ -14,7 +14,7 @@ namespace Prowlarr.Api.V1.Search
public string Type { get; set; }
public List<int> IndexerIds { get; set; }
public List<int> Categories { get; set; }
public int Limit { get; set; }
public int Offset { get; set; }
public int? Limit { get; set; }
public int? Offset { get; set; }
}
}