The Free Software Media System - Server Backend & API
Fix unchecked input
Bond_009914e891689af
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex db27862ce7..03da1add85 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -2956,7 +2956,7 @@ namespace Emby.Server.Implementations.Librarythrow new InvalidOperationException();}- public async Task AddVirtualFolder(string name, string collectionType, LibraryOptions options, bool refreshLibrary)+ public async Task AddVirtualFolder(string name, CollectionTypeOptions? collectionType, LibraryOptions options, bool refreshLibrary){if (string.IsNullOrWhiteSpace(name)){@@ -2990,9 +2990,9 @@ namespace Emby.Server.Implementations.Library{Directory.CreateDirectory(virtualFolderPath);- if (!string.IsNullOrEmpty(collectionType))+ if (collectionType != null){- var path = Path.Combine(virtualFolderPath, collectionType + ".collection");+ var path = Path.Combine(virtualFolderPath, collectionType.ToString() + ".collection");File.WriteAllBytes(path, Array.Empty<byte>());}diff --git a/Jellyfin.Api/Controllers/LibraryStructureController.cs b/Jellyfin.Api/Controllers/LibraryStructureController.csindex 94995650cb..328efea26e 100644--- a/Jellyfin.Api/Controllers/LibraryStructureController.cs+++ b/Jellyfin.Api/Controllers/LibraryStructureController.cs@@ -75,7 +75,7 @@ namespace Jellyfin.Api.Controllers[ProducesResponseType(StatusCodes.Status204NoContent)]public async Task<ActionResult> AddVirtualFolder([FromQuery] string? name,- [FromQuery] string? collectionType,+ [FromQuery] CollectionTypeOptions? collectionType,[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] paths,[FromBody] AddVirtualFolderDto? libraryOptionsDto,[FromQuery] bool refreshLibrary = false)diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.csindex 6700761fcc..80fcf71f3e 100644--- a/MediaBrowser.Controller/Library/ILibraryManager.cs+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs@@ -542,7 +542,7 @@ namespace MediaBrowser.Controller.LibraryGuid GetMusicGenreId(string name);- Task AddVirtualFolder(string name, string collectionType, LibraryOptions options, bool refreshLibrary);+ Task AddVirtualFolder(string name, CollectionTypeOptions? collectionType, LibraryOptions options, bool refreshLibrary);Task RemoveVirtualFolder(string name, bool refreshLibrary);diff --git a/MediaBrowser.Model/Entities/CollectionTypeOptions.cs b/MediaBrowser.Model/Entities/CollectionTypeOptions.csnew file mode 100644index 0000000000..d7615a7eda--- /dev/null+++ b/MediaBrowser.Model/Entities/CollectionTypeOptions.cs@@ -0,0 +1,15 @@+#pragma warning disable CS1591++namespace MediaBrowser.Model.Entities+{+ public enum CollectionTypeOptions+ {+ Movies,+ Music,+ TvShows,+ Books,+ HomeVideos,+ MusicVideos,+ Mixed+ }+}