Procházet zdrojové kódy

Reverted Test code

JPVenson před 7 měsíci
rodič
revize
432cfba2e2

+ 1 - 8
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();
     }

+ 5 - 0
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,