From cce6bf27e034b5cd7917242ad6eaa05a6414d7d9 Mon Sep 17 00:00:00 2001 From: JPVenson Date: Thu, 2 Oct 2025 02:26:56 +0300 Subject: [PATCH] Add check for processing recursive data structures (#14897) --- MediaBrowser.Controller/Entities/Folder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 1abb394b5b..9950e78525 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -337,6 +337,11 @@ namespace MediaBrowser.Controller.Entities try { + if (GetParents().Any(f => f.Id.Equals(Id))) + { + throw new InvalidOperationException("Recursive datastructure detected abort processing this item."); + } + await ValidateChildrenInternal2(progress, recursive, refreshChildMetadata, allowRemoveRoot, refreshOptions, directoryService, cancellationToken).ConfigureAwait(false); } finally