Browse Source

fix folder cleanup check

pull/2781/head
Jason Dove 7 months ago
parent
commit
cb24bfdd1f
No known key found for this signature in database
  1. 11
      ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtworkHandler.cs

11
ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtworkHandler.cs

@ -153,11 +153,14 @@ public class DeleteOrphanedArtworkHandler( @@ -153,11 +153,14 @@ public class DeleteOrphanedArtworkHandler(
{
try
{
// don't delete direct children of artwork cache folder
var parent = fileSystem.Directory.GetParent(path);
if (parent != null && parent.FullName != FileSystemLayout.ArtworkCacheFolder)
// don't delete artwork cache folder or its direct children
if (path != FileSystemLayout.ArtworkCacheFolder)
{
fileSystem.Directory.Delete(path);
var parent = fileSystem.Directory.GetParent(path);
if (parent?.FullName != FileSystemLayout.ArtworkCacheFolder)
{
fileSystem.Directory.Delete(path);
}
}
}
catch (Exception ex)

Loading…
Cancel
Save