mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04: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;
|
_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)
|
protected override bool IsValid(PropertyValidatorContext context)
|
||||||
{
|
{
|
||||||
@@ -24,9 +24,7 @@ namespace Readarr.Api.V1.Author
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var authorResource = context.ParentContext.InstanceToValidate as AuthorResource;
|
if (context.ParentContext.InstanceToValidate is not AuthorResource authorResource)
|
||||||
|
|
||||||
if (authorResource == null)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -36,6 +34,9 @@ namespace Readarr.Api.V1.Author
|
|||||||
var author = authorResource.ToModel();
|
var author = authorResource.ToModel();
|
||||||
var authorFolder = _fileNameBuilder.GetAuthorFolder(author);
|
var authorFolder = _fileNameBuilder.GetAuthorFolder(author);
|
||||||
|
|
||||||
|
context.MessageFormatter.AppendArgument("rootFolderPath", rootFolderPath);
|
||||||
|
context.MessageFormatter.AppendArgument("authorFolder", authorFolder);
|
||||||
|
|
||||||
if (authorFolder == rootFolder)
|
if (authorFolder == rootFolder)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user