mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-22 15:56:58 +00:00
Fixed: Validate path on series update
This commit is contained in:
parent
620220b269
commit
ea0bfed700
1 changed files with 25 additions and 17 deletions
|
@ -72,26 +72,34 @@ namespace Sonarr.Api.V3.Series
|
||||||
_commandQueueManager = commandQueueManager;
|
_commandQueueManager = commandQueueManager;
|
||||||
_rootFolderService = rootFolderService;
|
_rootFolderService = rootFolderService;
|
||||||
|
|
||||||
Http.Validation.RuleBuilderExtensions.ValidId(SharedValidator.RuleFor(s => s.QualityProfileId));
|
SharedValidator.RuleFor(s => s.Path).Cascade(CascadeMode.Stop)
|
||||||
|
|
||||||
SharedValidator.RuleFor(s => s.Path)
|
|
||||||
.Cascade(CascadeMode.Stop)
|
|
||||||
.IsValidPath()
|
.IsValidPath()
|
||||||
.SetValidator(rootFolderValidator)
|
.SetValidator(rootFolderValidator)
|
||||||
.SetValidator(mappedNetworkDriveValidator)
|
.SetValidator(mappedNetworkDriveValidator)
|
||||||
.SetValidator(seriesPathValidator)
|
.SetValidator(seriesPathValidator)
|
||||||
.SetValidator(seriesAncestorValidator)
|
.SetValidator(seriesAncestorValidator)
|
||||||
.SetValidator(systemFolderValidator)
|
.SetValidator(systemFolderValidator)
|
||||||
.When(s => !s.Path.IsNullOrWhiteSpace());
|
.When(s => s.Path.IsNotNullOrWhiteSpace());
|
||||||
|
|
||||||
SharedValidator.RuleFor(s => s.QualityProfileId).SetValidator(qualityProfileExistsValidator);
|
PostValidator.RuleFor(s => s.Path).Cascade(CascadeMode.Stop)
|
||||||
|
.NotEmpty()
|
||||||
|
.IsValidPath()
|
||||||
|
.When(s => s.RootFolderPath.IsNullOrWhiteSpace());
|
||||||
|
PostValidator.RuleFor(s => s.RootFolderPath).Cascade(CascadeMode.Stop)
|
||||||
|
.NotEmpty()
|
||||||
|
.IsValidPath()
|
||||||
|
.SetValidator(rootFolderExistsValidator)
|
||||||
|
.SetValidator(seriesFolderAsRootFolderValidator)
|
||||||
|
.When(s => s.Path.IsNullOrWhiteSpace());
|
||||||
|
|
||||||
|
PutValidator.RuleFor(s => s.Path).Cascade(CascadeMode.Stop)
|
||||||
|
.NotEmpty()
|
||||||
|
.IsValidPath();
|
||||||
|
|
||||||
|
SharedValidator.RuleFor(s => s.QualityProfileId).Cascade(CascadeMode.Stop)
|
||||||
|
.ValidId()
|
||||||
|
.SetValidator(qualityProfileExistsValidator);
|
||||||
|
|
||||||
PostValidator.RuleFor(s => s.Path).IsValidPath().When(s => s.RootFolderPath.IsNullOrWhiteSpace());
|
|
||||||
PostValidator.RuleFor(s => s.RootFolderPath)
|
|
||||||
.IsValidPath()
|
|
||||||
.SetValidator(rootFolderExistsValidator)
|
|
||||||
.SetValidator(seriesFolderAsRootFolderValidator)
|
|
||||||
.When(s => s.Path.IsNullOrWhiteSpace());
|
|
||||||
PostValidator.RuleFor(s => s.Title).NotEmpty();
|
PostValidator.RuleFor(s => s.Title).NotEmpty();
|
||||||
PostValidator.RuleFor(s => s.TvdbId).GreaterThan(0).SetValidator(seriesExistsValidator);
|
PostValidator.RuleFor(s => s.TvdbId).GreaterThan(0).SetValidator(seriesExistsValidator);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue