mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 06:48:35 +01:00
Removing CollectionFolders from cache when they are deleted on disk. (#13315)
This commit is contained in:
@@ -1049,9 +1049,17 @@ namespace Emby.Server.Implementations.Library
|
|||||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
// Quickly scan CollectionFolders for changes
|
// Quickly scan CollectionFolders for changes
|
||||||
foreach (var folder in GetUserRootFolder().Children.OfType<Folder>())
|
foreach (var child in GetUserRootFolder().Children.OfType<Folder>())
|
||||||
{
|
{
|
||||||
await folder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
// If the user has somehow deleted the collection directory, remove the metadata from the database.
|
||||||
|
if (child is CollectionFolder collectionFolder && !Directory.Exists(collectionFolder.Path))
|
||||||
|
{
|
||||||
|
_itemRepository.DeleteItem(collectionFolder.Id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await child.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user