From cbf382625ff1a1485a1deadc2f87194a2611ac63 Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 23 Sep 2020 22:29:55 -0400 Subject: [PATCH] Fixed: Preferred word can't have a term that is empty or only spaces Fixes #218 Co-Authored-By: Mark McDowall --- .../Profiles/Release/ReleaseProfileController.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Readarr.Api.V1/Profiles/Release/ReleaseProfileController.cs b/src/Readarr.Api.V1/Profiles/Release/ReleaseProfileController.cs index 2ea3d8466..c211d9763 100644 --- a/src/Readarr.Api.V1/Profiles/Release/ReleaseProfileController.cs +++ b/src/Readarr.Api.V1/Profiles/Release/ReleaseProfileController.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using FluentValidation; using Microsoft.AspNetCore.Mvc; using NzbDrone.Common.Extensions; @@ -32,6 +33,11 @@ public ReleaseProfileController(IReleaseProfileService releaseProfileService, II { context.AddFailure(nameof(ReleaseProfile.IndexerId), "Indexer does not exist"); } + + if (restriction.Preferred.Any(p => p.Key.IsNullOrWhiteSpace())) + { + context.AddFailure("Preferred", "Term cannot be empty or consist of only spaces"); + } }); }