Fix remote media cache cleanup

This commit is contained in:
Laura Hausmann 2023-08-29 19:29:58 +02:00
parent bae16e5eda
commit cfff8f840d
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605

View File

@ -14,12 +14,12 @@ export default async function cleanRemoteFiles(
done: any,
): Promise<void> {
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)