1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-03-05 13:20:20 -05:00

Fixed: Avoid requests without categories for FileList

This commit is contained in:
Bogdan
2025-03-30 15:26:18 +03:00
committed by Mark McDowall
parent 9cb9c711be
commit 4728fa29ef
2 changed files with 14 additions and 0 deletions

View File

@@ -137,6 +137,11 @@ namespace NzbDrone.Core.Indexers.FileList
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);

View File

@@ -2,6 +2,7 @@ using System;
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 @@ namespace NzbDrone.Core.Indexers.FileList
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());
}
}