Fixed an issue when trying to delete a theme file where temp/ already had a copy, Kavita wouldn't delete.

This commit is contained in:
Joe Milazzo 2026-01-15 09:52:21 -06:00
parent 0fdfd0451c
commit 3c250c656b

View File

@ -505,7 +505,13 @@ public class ThemeService : IThemeService
_directoryService.FileSystem.Path.Join(_directoryService.SiteThemeDirectory, theme.FileName);
var newLocation =
_directoryService.FileSystem.Path.Join(_directoryService.TempDirectory, theme.FileName);
_directoryService.CopyFileToDirectory(existingLocation, newLocation);
if (!_directoryService.FileSystem.File.Exists(newLocation))
{
_logger.LogInformation("Copying Deleted theme file ({FileName}) to config/temp, it will be removed at midnight", theme.FileName);
_directoryService.CopyFileToDirectory(existingLocation, newLocation);
}
_directoryService.DeleteFiles([existingLocation]);
}
catch (Exception) { /* Swallow */ }