Fixed: Preferred word can't have a term that is empty or only spaces

This commit is contained in:
Mark McDowall 2020-03-29 14:54:14 -07:00
parent 642f75761f
commit 219494ea9d
1 changed files with 6 additions and 0 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using FluentValidation; using FluentValidation;
using FluentValidation.Results; using FluentValidation.Results;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
@ -36,6 +37,11 @@ namespace Sonarr.Api.V3.Profiles.Release
{ {
context.AddFailure(nameof(ReleaseProfile.IndexerId), "Indexer does not exist"); 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");
}
}); });
} }