From 2699f7c0d745b7f0c98029219bc875b62124413e Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 11 Dec 2022 18:59:50 -0600 Subject: [PATCH] Fixed: Use route Id for PUT requests if not passed in body Closes #1994 --- src/Readarr.Http/REST/RestController.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Readarr.Http/REST/RestController.cs b/src/Readarr.Http/REST/RestController.cs index 7b9b75341..9bef16d46 100644 --- a/src/Readarr.Http/REST/RestController.cs +++ b/src/Readarr.Http/REST/RestController.cs @@ -69,6 +69,12 @@ namespace Readarr.Http.REST foreach (var resource in resourceArgs) { + // Map route Id to body resource if not set in request + if (Request.Method == "PUT" && resource.Id == 0 && context.RouteData.Values.TryGetValue("id", out var routeId)) + { + resource.Id = Convert.ToInt32(routeId); + } + ValidateResource(resource, skipValidate, skipShared); } }