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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -120,7 +120,7 @@ private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCr
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 @@ private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCr
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 @@ public SearchResource()
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; }
}
}