mirror of
https://github.com/Readarr/Readarr
synced 2026-01-14 03:23:30 +01:00
Improve validation message for AuthorFolderAsRootFolderValidator
(cherry picked from commit a117001de673e80abd90d54a34a7c86292b3a649)
This commit is contained in:
parent
f819e582cf
commit
59a7605385
1 changed files with 5 additions and 4 deletions
|
|
@ -15,7 +15,7 @@ public AuthorFolderAsRootFolderValidator(IBuildFileNames fileNameBuilder)
|
|||
_fileNameBuilder = fileNameBuilder;
|
||||
}
|
||||
|
||||
protected override string GetDefaultMessageTemplate() => "Root folder path contains author folder";
|
||||
protected override string GetDefaultMessageTemplate() => "Root folder path '{rootFolderPath}' contains author folder '{authorFolder}'";
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
{
|
||||
|
|
@ -24,9 +24,7 @@ protected override bool IsValid(PropertyValidatorContext context)
|
|||
return true;
|
||||
}
|
||||
|
||||
var authorResource = context.ParentContext.InstanceToValidate as AuthorResource;
|
||||
|
||||
if (authorResource == null)
|
||||
if (context.ParentContext.InstanceToValidate is not AuthorResource authorResource)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -36,6 +34,9 @@ protected override bool IsValid(PropertyValidatorContext context)
|
|||
var author = authorResource.ToModel();
|
||||
var authorFolder = _fileNameBuilder.GetAuthorFolder(author);
|
||||
|
||||
context.MessageFormatter.AppendArgument("rootFolderPath", rootFolderPath);
|
||||
context.MessageFormatter.AppendArgument("authorFolder", authorFolder);
|
||||
|
||||
if (authorFolder == rootFolder)
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue