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. 7
      ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtworkHandler.cs

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

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

Loading…
Cancel
Save