From 75d3d120d3cf3221b39b05a929da9917ce73487e Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Fri, 5 Mar 2021 16:56:21 +0100 Subject: Fix UpdateMediaPath model binding (#5378) (cherry picked from commit d0a2d00b29d87e7f71e85efd38d2b6c8beafe4ea) Signed-off-by: Joshua M. Boniface --- Jellyfin.Api/Controllers/LibraryStructureController.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'Jellyfin.Api/Controllers/LibraryStructureController.cs') diff --git a/Jellyfin.Api/Controllers/LibraryStructureController.cs b/Jellyfin.Api/Controllers/LibraryStructureController.cs index 328efea26..be9127dd3 100644 --- a/Jellyfin.Api/Controllers/LibraryStructureController.cs +++ b/Jellyfin.Api/Controllers/LibraryStructureController.cs @@ -241,23 +241,20 @@ namespace Jellyfin.Api.Controllers /// /// Updates a media path. /// - /// The name of the library. - /// The path info. + /// The name of the library and path infos. /// A . /// Media path updated. /// The name of the library may not be empty. [HttpPost("Paths/Update")] [ProducesResponseType(StatusCodes.Status204NoContent)] - public ActionResult UpdateMediaPath( - [FromQuery] string? name, - [FromBody] MediaPathInfo? pathInfo) + public ActionResult UpdateMediaPath([FromBody, Required] UpdateMediaPathRequestDto mediaPathRequestDto) { - if (string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(mediaPathRequestDto.Name)) { - throw new ArgumentNullException(nameof(name)); + throw new ArgumentNullException(nameof(mediaPathRequestDto), "Name must not be null or empty"); } - _libraryManager.UpdateMediaPath(name, pathInfo); + _libraryManager.UpdateMediaPath(mediaPathRequestDto.Name, mediaPathRequestDto.PathInfo); return NoContent(); } -- cgit v1.2.3