From 2cc835d4566f559b739ff54a9008f612a351429e 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 #3133 --- src/Lidarr.Http/REST/RestController.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Lidarr.Http/REST/RestController.cs b/src/Lidarr.Http/REST/RestController.cs index 187084077..4a9f5d607 100644 --- a/src/Lidarr.Http/REST/RestController.cs +++ b/src/Lidarr.Http/REST/RestController.cs @@ -57,6 +57,12 @@ namespace Lidarr.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); } }