Return error if Manual Import called without items

Closes #7942
This commit is contained in:
Mark McDowall 2025-06-28 18:25:16 -07:00
parent 4b50861a6b
commit e85d6d0744
No known key found for this signature in database

View file

@ -8,6 +8,7 @@
using Sonarr.Api.V3.CustomFormats; using Sonarr.Api.V3.CustomFormats;
using Sonarr.Api.V3.Episodes; using Sonarr.Api.V3.Episodes;
using Sonarr.Http; using Sonarr.Http;
using Sonarr.Http.REST;
namespace Sonarr.Api.V3.ManualImport namespace Sonarr.Api.V3.ManualImport
{ {
@ -37,6 +38,11 @@ public List<ManualImportResource> GetMediaFiles(string folder, string downloadId
[Consumes("application/json")] [Consumes("application/json")]
public object ReprocessItems([FromBody] List<ManualImportReprocessResource> items) public object ReprocessItems([FromBody] List<ManualImportReprocessResource> items)
{ {
if (items is { Count: 0 })
{
throw new BadRequestException("items must be provided");
}
foreach (var item in items) foreach (var item in items)
{ {
var processedItem = _manualImportService.ReprocessItem(item.Path, item.DownloadId, item.SeriesId, item.SeasonNumber, item.EpisodeIds ?? new List<int>(), item.ReleaseGroup, item.Quality, item.Languages, item.IndexerFlags, item.ReleaseType); var processedItem = _manualImportService.ReprocessItem(item.Path, item.DownloadId, item.SeriesId, item.SeasonNumber, item.EpisodeIds ?? new List<int>(), item.ReleaseGroup, item.Quality, item.Languages, item.IndexerFlags, item.ReleaseType);