New: Newznab/Torznab categories dropdown with indexer provided category names

This commit is contained in:
Taloth 2020-10-08 23:33:13 +02:00 committed by Qstick
parent 2d8657a77f
commit 9b1bbaef02
22 changed files with 429 additions and 36 deletions

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using FluentValidation;
using FluentValidation.Results;
using Lidarr.Http.Extensions;
using Nancy;
using Nancy.Responses.Negotiation;
@ -224,7 +225,7 @@ namespace Lidarr.Http.REST
return Negotiate.WithModel(model).WithStatusCode(statusCode);
}
protected TResource ReadResourceFromRequest(bool skipValidate = false)
protected TResource ReadResourceFromRequest(bool skipValidate = false, bool skipSharedValidate = false)
{
var resource = new TResource();
@ -242,7 +243,12 @@ namespace Lidarr.Http.REST
throw new BadRequestException("Request body can't be empty");
}
var errors = SharedValidator.Validate(resource).Errors.ToList();
var errors = new List<ValidationFailure>();
if (!skipSharedValidate)
{
errors.AddRange(SharedValidator.Validate(resource).Errors);
}
if (Request.Method.Equals("POST", StringComparison.InvariantCultureIgnoreCase) && !skipValidate && !Request.Url.Path.EndsWith("/test", StringComparison.InvariantCultureIgnoreCase))
{