aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgnattu <gnattuoc@me.com>2024-04-13 14:48:40 +0800
committergnattu <gnattuoc@me.com>2024-04-13 14:48:40 +0800
commit204146a3a504c4cc417c9eb68c32271e3f585352 (patch)
tree8db1a0c070d4e87d75855154247ebab7787216ff
parentc566ccb63bf61f9c36743ddb2108a57c65a2519b (diff)
fix: mark UserRoot as non-root when performing removal
Fixes #11269 Signed-off-by: gnattu <gnattuoc@me.com>
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index bb5cc746e..baed887e3 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -1033,7 +1033,7 @@ namespace Emby.Server.Implementations.Library
}
}
- private async Task ValidateTopLibraryFolders(CancellationToken cancellationToken)
+ private async Task ValidateTopLibraryFolders(CancellationToken cancellationToken, bool removeRoot = false)
{
await RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
@@ -1046,11 +1046,15 @@ namespace Emby.Server.Implementations.Library
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
+ // HACK: override IsRootHere for libraries to be removed
+ if (removeRoot) GetUserRootFolder().IsRoot = false;
await GetUserRootFolder().ValidateChildren(
new Progress<double>(),
new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
recursive: false,
cancellationToken).ConfigureAwait(false);
+ // HACK: restore IsRoot here after validation
+ if (removeRoot) GetUserRootFolder().IsRoot = true;
// Quickly scan CollectionFolders for changes
foreach (var folder in GetUserRootFolder().Children.OfType<Folder>())
@@ -3118,7 +3122,7 @@ namespace Emby.Server.Implementations.Library
if (refreshLibrary)
{
- await ValidateTopLibraryFolders(CancellationToken.None).ConfigureAwait(false);
+ await ValidateTopLibraryFolders(CancellationToken.None, true).ConfigureAwait(false);
StartScanInBackground();
}