mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-04-24 06:17:08 -04:00
Prevent NullRef for empty ids in bulk endpoint
This commit is contained in:
parent
2693ada7de
commit
0d3e9a2196
2 changed files with 10 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue