Prevent NullRef for empty ids in bulk endpoint
This commit is contained in:
parent
2693ada7de
commit
0d3e9a2196
|
@ -9,6 +9,11 @@ namespace Sonarr.Api.V3
|
|||
public List<int> Ids { get; set; }
|
||||
public List<int> Tags { get; set; }
|
||||
public ApplyTags ApplyTags { get; set; }
|
||||
|
||||
public ProviderBulkResource()
|
||||
{
|
||||
Ids = new List<int>();
|
||||
}
|
||||
}
|
||||
|
||||
public class ProviderBulkResourceMapper<TProviderBulkResource, TProviderDefinition>
|
||||
|
|
|
@ -106,6 +106,11 @@ namespace Sonarr.Api.V3
|
|||
[Produces("application/json")]
|
||||
public ActionResult<TProviderResource> UpdateProvider([FromBody] TBulkProviderResource providerResource)
|
||||
{
|
||||
if (!providerResource.Ids.Any())
|
||||
{
|
||||
throw new BadRequestException("ids must be provided");
|
||||
}
|
||||
|
||||
var definitionsToUpdate = _providerFactory.Get(providerResource.Ids).ToList();
|
||||
|
||||
foreach (var definition in definitionsToUpdate)
|
||||
|
|
Loading…
Reference in New Issue