From 080dd301f33d295b0b1fd62a2d7c4cfd648955b6 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Thu, 20 Mar 2025 13:10:06 +0200 Subject: [PATCH] Fixed: Priority validation for indexers and download clients (cherry picked from commit f0e320f3aa501f120721503b8256f464a31be783) --- src/Readarr.Api.V1/DownloadClient/DownloadClientController.cs | 2 ++ src/Readarr.Api.V1/Indexers/IndexerController.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Readarr.Api.V1/DownloadClient/DownloadClientController.cs b/src/Readarr.Api.V1/DownloadClient/DownloadClientController.cs index 86dbd742b..5fc901e41 100644 --- a/src/Readarr.Api.V1/DownloadClient/DownloadClientController.cs +++ b/src/Readarr.Api.V1/DownloadClient/DownloadClientController.cs @@ -1,3 +1,4 @@ +using FluentValidation; using NzbDrone.Core.Download; using Readarr.Http; @@ -12,6 +13,7 @@ namespace Readarr.Api.V1.DownloadClient public DownloadClientController(IDownloadClientFactory downloadClientFactory) : base(downloadClientFactory, "downloadclient", ResourceMapper, BulkResourceMapper) { + SharedValidator.RuleFor(c => c.Priority).InclusiveBetween(1, 50); } } } diff --git a/src/Readarr.Api.V1/Indexers/IndexerController.cs b/src/Readarr.Api.V1/Indexers/IndexerController.cs index df44ebe50..76d53861a 100644 --- a/src/Readarr.Api.V1/Indexers/IndexerController.cs +++ b/src/Readarr.Api.V1/Indexers/IndexerController.cs @@ -1,3 +1,4 @@ +using FluentValidation; using NzbDrone.Core.Indexers; using NzbDrone.Core.Validation; using Readarr.Http; @@ -13,6 +14,7 @@ namespace Readarr.Api.V1.Indexers public IndexerController(IndexerFactory indexerFactory, DownloadClientExistsValidator downloadClientExistsValidator) : base(indexerFactory, "indexer", ResourceMapper, BulkResourceMapper) { + SharedValidator.RuleFor(c => c.Priority).InclusiveBetween(1, 50); SharedValidator.RuleFor(c => c.DownloadClientId).SetValidator(downloadClientExistsValidator); } }