mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-24 23:02:44 +00:00
Fixed: Use route Id for PUT requests if not passed in body
Closes #3133
This commit is contained in:
parent
4fd389021a
commit
2cc835d456
1 changed files with 6 additions and 0 deletions
|
@ -57,6 +57,12 @@ public override void OnActionExecuting(ActionExecutingContext context)
|
||||||
|
|
||||||
foreach (var resource in resourceArgs)
|
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);
|
ValidateResource(resource, skipValidate, skipShared);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue