mirror of
https://github.com/Sonarr/Sonarr
synced 2026-01-07 16:16:39 +01:00
Fixed: Avoid requests without categories for FileList
This commit is contained in:
parent
9cb9c711be
commit
4728fa29ef
2 changed files with 14 additions and 0 deletions
|
|
@ -137,6 +137,11 @@ private void AddNameRequests(IndexerPageableRequestChain chain, SearchCriteriaBa
|
|||
|
||||
private IEnumerable<IndexerRequest> GetRequest(string searchType, IEnumerable<int> categories, string parameters)
|
||||
{
|
||||
if (categories.Empty())
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
var categoriesQuery = string.Join(",", categories.Distinct());
|
||||
|
||||
var baseUrl = string.Format("{0}/api.php?action={1}&category={2}{3}", Settings.BaseUrl.TrimEnd('/'), searchType, categoriesQuery, parameters);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using Equ;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
|
@ -16,6 +17,14 @@ public FileListSettingsValidator()
|
|||
RuleFor(c => c.Username).NotEmpty();
|
||||
RuleFor(c => c.Passkey).NotEmpty();
|
||||
|
||||
RuleFor(c => c).Custom((c, context) =>
|
||||
{
|
||||
if (c.Categories.Empty() && c.AnimeCategories.Empty())
|
||||
{
|
||||
context.AddFailure("Either 'Categories' or 'Anime Categories' must be provided");
|
||||
}
|
||||
});
|
||||
|
||||
RuleFor(c => c.SeedCriteria).SetValidator(_ => new SeedCriteriaSettingsValidator());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue