mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-05 06:35:13 -04:00
Validate Collection Folders on adding and removal (#11444)
This commit is contained in:
parent
77a101cc98
commit
3ae0fb90cb
@ -1038,6 +1038,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
new Progress<double>(),
|
new Progress<double>(),
|
||||||
new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
|
new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
|
||||||
recursive: false,
|
recursive: false,
|
||||||
|
allowRemoveRoot: removeRoot,
|
||||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
@ -159,7 +159,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
ClearCache();
|
ClearCache();
|
||||||
|
|
||||||
await base.ValidateChildrenInternal(progress, recursive, refreshChildMetadata, false, refreshOptions, directoryService, cancellationToken)
|
await base.ValidateChildrenInternal(progress, recursive, refreshChildMetadata, allowRemoveRoot, refreshOptions, directoryService, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
ClearCache();
|
ClearCache();
|
||||||
|
@ -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
|
// For top parents i.e. Library folders, skip the validation if it's empty or inaccessible
|
||||||
if (item.IsTopParent && !directoryService.IsAccessible(item.ContainingFolderPath))
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
@ -388,7 +393,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
foreach (var child in nonCachedChildren)
|
foreach (var child in nonCachedChildren)
|
||||||
{
|
{
|
||||||
if (!IsLibraryFolderAccessible(directoryService, child))
|
if (!IsLibraryFolderAccessible(directoryService, child, allowRemoveRoot))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user