ソースを参照

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
Thanh Pham 2 年 前
コミット
3aa6ee0320

+ 10 - 1
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);
           }
         });
       }