mirror of
https://github.com/fergalmoran/Readarr.git
synced 2025-12-22 09:29:59 +00:00
Improve validation message for AuthorFolderAsRootFolderValidator
(cherry picked from commit a117001de673e80abd90d54a34a7c86292b3a649)
This commit is contained in:
@@ -15,7 +15,7 @@ namespace Readarr.Api.V1.Author
|
||||
_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 @@ namespace Readarr.Api.V1.Author
|
||||
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 @@ namespace Readarr.Api.V1.Author
|
||||
var author = authorResource.ToModel();
|
||||
var authorFolder = _fileNameBuilder.GetAuthorFolder(author);
|
||||
|
||||
context.MessageFormatter.AppendArgument("rootFolderPath", rootFolderPath);
|
||||
context.MessageFormatter.AppendArgument("authorFolder", authorFolder);
|
||||
|
||||
if (authorFolder == rootFolder)
|
||||
{
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user