0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-07 00:50:23 -05:00

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
This commit is contained in:
Thanh Pham 2022-08-18 20:25:03 +07:00 committed by GitHub
parent cdb0aa00d8
commit 3aa6ee0320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}
});
}