From 3aa6ee0320a8a96ea01599049e7e2c0612e4c1bf Mon Sep 17 00:00:00 2001 From: Thanh Pham Date: Thu, 18 Aug 2022 20:25:03 +0700 Subject: [PATCH] feat: remove webp on asset deleted as well (#489) * fix(server): remove webp file on asset deleted * chore(server): job not fail when file not found --- .../background-task/background-task.processor.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/apps/immich/src/modules/background-task/background-task.processor.ts b/server/apps/immich/src/modules/background-task/background-task.processor.ts index dfd11d2f30..a5fa1c5e06 100644 --- a/server/apps/immich/src/modules/background-task/background-task.processor.ts +++ b/server/apps/immich/src/modules/background-task/background-task.processor.ts @@ -30,10 +30,19 @@ export class BackgroundTaskProcessor { }); // TODO: what if there is no asset.resizePath. Should fail the Job? + // => panoti report: Job not fail if (asset.resizePath) { fs.unlink(asset.resizePath, (err) => { if (err) { - console.log('error deleting ', asset.originalPath); + console.log('error deleting ', asset.resizePath); + } + }); + } + + if (asset.webpPath) { + fs.unlink(asset.webpPath, (err) => { + if (err) { + console.log('error deleting ', asset.webpPath); } }); }