diff options
| -rw-r--r-- | Jellyfin.Api/Controllers/LibraryStructureController.cs | 10 | ||||
| -rw-r--r-- | tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/Jellyfin.Api/Controllers/LibraryStructureController.cs b/Jellyfin.Api/Controllers/LibraryStructureController.cs index 93c2393f3..c52068000 100644 --- a/Jellyfin.Api/Controllers/LibraryStructureController.cs +++ b/Jellyfin.Api/Controllers/LibraryStructureController.cs @@ -106,7 +106,15 @@ public class LibraryStructureController : BaseJellyfinApiController [FromQuery] string name, [FromQuery] bool refreshLibrary = false) { - await _libraryManager.RemoveVirtualFolder(name, refreshLibrary).ConfigureAwait(false); + try + { + await _libraryManager.RemoveVirtualFolder(name, refreshLibrary).ConfigureAwait(false); + } + catch (Exception ex) + { + return BadRequest(ex.ToString()); + } + return NoContent(); } diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs index 0376f57cc..9d39b4bfa 100644 --- a/tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs +++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs @@ -120,6 +120,14 @@ public sealed class LibraryStructureControllerTests : IClassFixture<JellyfinAppl client.DefaultRequestHeaders.AddAuthHeader(_accessToken ??= await AuthHelper.CompleteStartupAsync(client)); using var response = await client.DeleteAsync("Library/VirtualFolders?name=test&refreshLibrary=true"); - Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); + try + { + Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); + } + catch (Exception) + { + Console.WriteLine("DeleteFailed: " + response.Content.ReadAsStringAsync()); + throw; + } } } |
