mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-10-31 02:27:18 -04:00 
			
		
		
		
	Fix UpdateMediaPath model binding (#5378)
This commit is contained in:
		
							parent
							
								
									a0f6bc14a2
								
							
						
					
					
						commit
						d0a2d00b29
					
				| @ -241,23 +241,20 @@ namespace Jellyfin.Api.Controllers | |||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Updates a media path. |         /// Updates a media path. | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         /// <param name="name">The name of the library.</param> |         /// <param name="mediaPathRequestDto">The name of the library and path infos.</param> | ||||||
|         /// <param name="pathInfo">The path info.</param> |  | ||||||
|         /// <returns>A <see cref="NoContentResult"/>.</returns> |         /// <returns>A <see cref="NoContentResult"/>.</returns> | ||||||
|         /// <response code="204">Media path updated.</response> |         /// <response code="204">Media path updated.</response> | ||||||
|         /// <exception cref="ArgumentNullException">The name of the library may not be empty.</exception> |         /// <exception cref="ArgumentNullException">The name of the library may not be empty.</exception> | ||||||
|         [HttpPost("Paths/Update")] |         [HttpPost("Paths/Update")] | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |         [ProducesResponseType(StatusCodes.Status204NoContent)] | ||||||
|         public ActionResult UpdateMediaPath( |         public ActionResult UpdateMediaPath([FromBody, Required] UpdateMediaPathRequestDto mediaPathRequestDto) | ||||||
|             [FromQuery] string? name, |  | ||||||
|             [FromBody] MediaPathInfo? pathInfo) |  | ||||||
|         { |         { | ||||||
|             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(); |             return NoContent(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -0,0 +1,23 @@ | |||||||
|  | using System.ComponentModel.DataAnnotations; | ||||||
|  | using MediaBrowser.Model.Configuration; | ||||||
|  | 
 | ||||||
|  | namespace Jellyfin.Api.Models.LibraryStructureDto | ||||||
|  | { | ||||||
|  |     /// <summary> | ||||||
|  |     /// Update library options dto. | ||||||
|  |     /// </summary> | ||||||
|  |     public class UpdateMediaPathRequestDto | ||||||
|  |     { | ||||||
|  |         /// <summary> | ||||||
|  |         /// Gets or sets the library name. | ||||||
|  |         /// </summary> | ||||||
|  |         [Required] | ||||||
|  |         public string Name { get; set; } = null!; | ||||||
|  | 
 | ||||||
|  |         /// <summary> | ||||||
|  |         /// Gets or sets library folder path information. | ||||||
|  |         /// </summary> | ||||||
|  |         [Required] | ||||||
|  |         public MediaPathInfo PathInfo { get; set; } = null!; | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user