The Free Software Media System - Server Backend & API
Fix model binding in UpdateLibraryOptions
Claus Vium7103e764a4f7
diff --git a/Jellyfin.Api/Controllers/LibraryStructureController.cs b/Jellyfin.Api/Controllers/LibraryStructureController.csindex cdab4f356f..d290e3c5bd 100644--- a/Jellyfin.Api/Controllers/LibraryStructureController.cs+++ b/Jellyfin.Api/Controllers/LibraryStructureController.cs@@ -76,7 +76,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? name,[FromQuery] string? collectionType,[FromQuery] string[] paths,- [FromBody] LibraryOptionsDto? libraryOptionsDto,+ [FromBody] AddVirtualFolderDto? libraryOptionsDto,[FromQuery] bool refreshLibrary = false){var libraryOptions = libraryOptionsDto?.LibraryOptions ?? new LibraryOptions();@@ -312,19 +312,17 @@ namespace Jellyfin.Api.Controllers/// <summary>/// Update library options./// </summary>- /// <param name="id">The library name.</param>- /// <param name="libraryOptions">The library options.</param>+ /// <param name="request">The library name and options.</param>/// <response code="204">Library updated.</response>/// <returns>A <see cref="NoContentResult"/>.</returns>[HttpPost("LibraryOptions")][ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult UpdateLibraryOptions(- [FromQuery] string? id,- [FromBody] LibraryOptions? libraryOptions)+ [FromBody] UpdateLibraryOptionsDto request){- var collectionFolder = (CollectionFolder)_libraryManager.GetItemById(id);+ var collectionFolder = (CollectionFolder)_libraryManager.GetItemById(request.Id);- collectionFolder.UpdateLibraryOptions(libraryOptions);+ collectionFolder.UpdateLibraryOptions(request.LibraryOptions);return NoContent();}}diff --git a/Jellyfin.Api/Models/LibraryStructureDto/LibraryOptionsDto.cs b/Jellyfin.Api/Models/LibraryStructureDto/AddVirtualFolderDto.cssimilarity index 80%rename from Jellyfin.Api/Models/LibraryStructureDto/LibraryOptionsDto.csrename to Jellyfin.Api/Models/LibraryStructureDto/AddVirtualFolderDto.csindex a13cb90dbe..ab68d52238 100644--- a/Jellyfin.Api/Models/LibraryStructureDto/LibraryOptionsDto.cs+++ b/Jellyfin.Api/Models/LibraryStructureDto/AddVirtualFolderDto.cs@@ -3,13 +3,13 @@namespace Jellyfin.Api.Models.LibraryStructureDto{/// <summary>- /// Library options dto.+ /// Add virtual folder dto./// </summary>- public class LibraryOptionsDto+ public class AddVirtualFolderDto{/// <summary>/// Gets or sets library options./// </summary>public LibraryOptions? LibraryOptions { get; set; }}-}\ No newline at end of file+}diff --git a/Jellyfin.Api/Models/LibraryStructureDto/UpdateLibraryOptionsDto.cs b/Jellyfin.Api/Models/LibraryStructureDto/UpdateLibraryOptionsDto.csnew file mode 100644index 0000000000..c78ed51f78--- /dev/null+++ b/Jellyfin.Api/Models/LibraryStructureDto/UpdateLibraryOptionsDto.cs@@ -0,0 +1,21 @@+using System;+using MediaBrowser.Model.Configuration;++namespace Jellyfin.Api.Models.LibraryStructureDto+{+ /// <summary>+ /// Update library options dto.+ /// </summary>+ public class UpdateLibraryOptionsDto+ {+ /// <summary>+ /// Gets or sets the library item id.+ /// </summary>+ public Guid Id { get; set; }++ /// <summary>+ /// Gets or sets library options.+ /// </summary>+ public LibraryOptions? LibraryOptions { get; set; }+ }+}