From 2fecd280016630d5afe2d60e52cbb52338c155b5 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 14 May 2023 10:20:28 +0300 Subject: [PATCH] Fix validation for boolean query parameters --- src/Sonarr.Api.V3/Episodes/EpisodeController.cs | 4 +--- src/Sonarr.Api.V3/Series/SeriesController.cs | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Sonarr.Api.V3/Episodes/EpisodeController.cs b/src/Sonarr.Api.V3/Episodes/EpisodeController.cs index 1d71bb1df..06f034d8f 100644 --- a/src/Sonarr.Api.V3/Episodes/EpisodeController.cs +++ b/src/Sonarr.Api.V3/Episodes/EpisodeController.cs @@ -62,10 +62,8 @@ namespace Sonarr.Api.V3.Episodes [HttpPut("monitor")] [Consumes("application/json")] - public IActionResult SetEpisodesMonitored([FromBody] EpisodesMonitoredResource resource) + public IActionResult SetEpisodesMonitored([FromBody] EpisodesMonitoredResource resource, [FromQuery] bool includeImages = false) { - var includeImages = Request.GetBooleanQueryParameter("includeImages", false); - if (resource.EpisodeIds.Count == 1) { _episodeService.SetEpisodeMonitored(resource.EpisodeIds.First(), resource.Monitored); diff --git a/src/Sonarr.Api.V3/Series/SeriesController.cs b/src/Sonarr.Api.V3/Series/SeriesController.cs index b8a4c1c29..d0867764f 100644 --- a/src/Sonarr.Api.V3/Series/SeriesController.cs +++ b/src/Sonarr.Api.V3/Series/SeriesController.cs @@ -138,9 +138,8 @@ namespace Sonarr.Api.V3.Series [RestPutById] [Consumes("application/json")] - public ActionResult UpdateSeries(SeriesResource seriesResource) + public ActionResult UpdateSeries(SeriesResource seriesResource, bool moveFiles = false) { - var moveFiles = Request.GetBooleanQueryParameter("moveFiles"); var series = _seriesService.GetSeries(seriesResource.Id); if (moveFiles) @@ -167,11 +166,8 @@ namespace Sonarr.Api.V3.Series } [RestDeleteById] - public void DeleteSeries(int id) + public void DeleteSeries(int id, bool deleteFiles = false, bool addImportListExclusion = false) { - var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles"); - var addImportListExclusion = Request.GetBooleanQueryParameter("addImportListExclusion"); - _seriesService.DeleteSeries(new List { id }, deleteFiles, addImportListExclusion); }