aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Jellyfin.Api/Controllers/LibraryStructureController.cs9
-rw-r--r--Jellyfin.Server.Implementations/Item/BaseItemRepository.cs5
2 files changed, 6 insertions, 8 deletions
diff --git a/Jellyfin.Api/Controllers/LibraryStructureController.cs b/Jellyfin.Api/Controllers/LibraryStructureController.cs
index c52068000..c3e3b659b 100644
--- a/Jellyfin.Api/Controllers/LibraryStructureController.cs
+++ b/Jellyfin.Api/Controllers/LibraryStructureController.cs
@@ -106,14 +106,7 @@ public class LibraryStructureController : BaseJellyfinApiController
[FromQuery] string name,
[FromQuery] bool refreshLibrary = false)
{
- try
- {
- await _libraryManager.RemoveVirtualFolder(name, refreshLibrary).ConfigureAwait(false);
- }
- catch (Exception ex)
- {
- return BadRequest(ex.ToString());
- }
+ await _libraryManager.RemoveVirtualFolder(name, refreshLibrary).ConfigureAwait(false);
return NoContent();
}
diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs
index f1afd3543..14300d237 100644
--- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs
+++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs
@@ -1290,6 +1290,11 @@ public sealed class BaseItemRepository(
{
foreach (var ancestorId in item.AncestorIds)
{
+ if (!context.BaseItems.Any(f => f.Id == ancestorId))
+ {
+ throw new InvalidOperationException($"Cannot link non-existent parent: {ancestorId}");
+ }
+
context.AncestorIds.Add(new AncestorId()
{
ParentItemId = ancestorId,