diff options
| author | gnattu <gnattu@users.noreply.github.com> | 2024-05-05 22:21:40 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-05 08:21:40 -0600 |
| commit | 3ae0fb90cba3040ad36d3a9f591ee6b3c1a46766 (patch) | |
| tree | b96de9ed4be9f1a12fb87fdbeada3b18d03ccfc4 /MediaBrowser.Controller/Entities/Folder.cs | |
| parent | 77a101cc982a3d0aa14d230999cca2a452153a20 (diff) | |
Validate Collection Folders on adding and removal (#11444)
Diffstat (limited to 'MediaBrowser.Controller/Entities/Folder.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 45c27fdc0..f39fa79eb 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -333,8 +333,13 @@ namespace MediaBrowser.Controller.Entities } } - private static bool IsLibraryFolderAccessible(IDirectoryService directoryService, BaseItem item) + private static bool IsLibraryFolderAccessible(IDirectoryService directoryService, BaseItem item, bool checkCollection) { + if (!checkCollection && (item is BoxSet || string.Equals(item.FileNameWithoutExtension, "collections", StringComparison.OrdinalIgnoreCase))) + { + return true; + } + // For top parents i.e. Library folders, skip the validation if it's empty or inaccessible if (item.IsTopParent && !directoryService.IsAccessible(item.ContainingFolderPath)) { @@ -347,7 +352,7 @@ namespace MediaBrowser.Controller.Entities private async Task ValidateChildrenInternal2(IProgress<double> progress, bool recursive, bool refreshChildMetadata, bool allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken) { - if (!IsLibraryFolderAccessible(directoryService, this)) + if (!IsLibraryFolderAccessible(directoryService, this, allowRemoveRoot)) { return; } @@ -388,7 +393,7 @@ namespace MediaBrowser.Controller.Entities foreach (var child in nonCachedChildren) { - if (!IsLibraryFolderAccessible(directoryService, child)) + if (!IsLibraryFolderAccessible(directoryService, child, allowRemoveRoot)) { continue; } |
