1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-28 06:31:58 +00:00

Move logic to asset deletion check

This commit is contained in:
Jonathan Jogenfors 2024-12-19 14:48:43 +01:00
parent e8c5fcf64d
commit b6631cdf1f

View file

@ -188,7 +188,7 @@ export class AssetService extends BaseService {
name: JobName.ASSET_DELETION,
data: {
id: asset.id,
deleteOnDisk: true,
deleteOnDisk: !asset.isOffline,
},
})),
);
@ -250,17 +250,7 @@ export class AssetService extends BaseService {
const { thumbnailFile, previewFile } = getAssetFiles(asset.files);
const files = [thumbnailFile?.path, previewFile?.path, asset.encodedVideoPath];
let willDelete = deleteOnDisk;
if (asset.isOffline) {
/* We don't want to delete an offline asset because it is either...
...missing from disk => don't delete the file since it doesn't exist where we expect
...outside of any import path => don't delete the file since we're not responsible for it
...matching an exclusion pattern => don't delete the file since we're not responsible for it */
willDelete = false;
}
if (willDelete) {
if (deleteOnDisk) {
files.push(asset.sidecarPath, asset.originalPath);
}