From cfff8f840dedb08d4788ecd4028feb6664afd256 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Tue, 29 Aug 2023 19:29:58 +0200 Subject: [PATCH] Fix remote media cache cleanup --- .../processors/object-storage/clean-remote-files.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts index 5e54dd4ad..6db84aabe 100644 --- a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts +++ b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts @@ -14,12 +14,12 @@ export default async function cleanRemoteFiles( done: any, ): Promise { let progress = 0; - let until = new Date(Date.now() - ((new Date()).getTimezoneOffset() * 60000)); - until.setDate(until.getDate() - (config.mediaCleanup?.maxAgeDays ?? 0)); - const avatars = config.mediaCleanup?.avatars ?? false; - const headers = config.mediaCleanup?.headers ?? false; + const untilDate = new Date(Date.now() - ((new Date()).getTimezoneOffset() * 60000)); + untilDate.setDate(untilDate.getDate() - (config.mediaCleanup?.maxAgeDays ?? 0)); + const avatars = !(config.mediaCleanup?.keepHeaders ?? true); + const headers = !(config.mediaCleanup?.keepHeaders ?? true); - until = until.toISOString().replace("T", " ").slice(0, -1); + const until = untilDate.toISOString().replace("T", " ").slice(0, -1); let target = "files"; if (avatars)