From 484c255fd4f615629e75f00f68384c269cc1c584 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 8 Jul 2023 21:19:40 +0300 Subject: [PATCH] Add validation for MinPopularity and MinPages in metadata profiles --- .../Profiles/Metadata/MetadataProfileController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Readarr.Api.V1/Profiles/Metadata/MetadataProfileController.cs b/src/Readarr.Api.V1/Profiles/Metadata/MetadataProfileController.cs index ab2c9f2ad..c3c47056a 100644 --- a/src/Readarr.Api.V1/Profiles/Metadata/MetadataProfileController.cs +++ b/src/Readarr.Api.V1/Profiles/Metadata/MetadataProfileController.cs @@ -18,7 +18,12 @@ namespace Readarr.Api.V1.Profiles.Metadata public MetadataProfileController(IMetadataProfileService profileService) { _profileService = profileService; - SharedValidator.RuleFor(c => c.Name).NotEqual("None").WithMessage("'None' is a reserved profile name").NotEmpty(); + + SharedValidator.RuleFor(c => c.Name) + .NotEqual("None").WithMessage("'None' is a reserved profile name") + .NotEmpty(); + SharedValidator.RuleFor(c => c.MinPopularity).GreaterThanOrEqualTo(0); + SharedValidator.RuleFor(c => c.MinPages).GreaterThanOrEqualTo(0); SharedValidator.RuleFor(c => c.AllowedLanguages) .Must(x => x .Trim(',')