mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-29 19:28:27 -07:00
Fixed: Enforce validation warnings
(cherry picked from commit 48ee1158ad4213fd0690842e2672f52d08f7ad26) Closes #3761
This commit is contained in:
parent
a05082b4c6
commit
59b4441b0d
3 changed files with 6 additions and 8 deletions
|
@ -58,9 +58,9 @@ namespace Lidarr.Api.V1
|
|||
}
|
||||
|
||||
[RestPostById]
|
||||
public ActionResult<TProviderResource> CreateProvider(TProviderResource providerResource)
|
||||
public ActionResult<TProviderResource> CreateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false)
|
||||
{
|
||||
var providerDefinition = GetDefinition(providerResource, true, false, false);
|
||||
var providerDefinition = GetDefinition(providerResource, true, !forceSave, false);
|
||||
|
||||
if (providerDefinition.Enable)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ namespace Lidarr.Api.V1
|
|||
[RestPutById]
|
||||
public ActionResult<TProviderResource> UpdateProvider([FromBody] TProviderResource providerResource, [FromQuery] bool forceSave = false)
|
||||
{
|
||||
var providerDefinition = GetDefinition(providerResource, true, false, false);
|
||||
var providerDefinition = GetDefinition(providerResource, true, !forceSave, false);
|
||||
|
||||
// Only test existing definitions if it is enabled and forceSave isn't set.
|
||||
if (providerDefinition.Enable && !forceSave)
|
||||
|
@ -191,7 +191,7 @@ namespace Lidarr.Api.V1
|
|||
|
||||
protected void VerifyValidationResult(ValidationResult validationResult, bool includeWarnings)
|
||||
{
|
||||
var result = new NzbDroneValidationResult(validationResult.Errors);
|
||||
var result = validationResult as NzbDroneValidationResult ?? new NzbDroneValidationResult(validationResult.Errors);
|
||||
|
||||
if (includeWarnings && (!result.IsValid || result.HasWarnings))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue