mirror of
https://github.com/immich-app/immich.git
synced 2024-12-25 10:43:13 +02:00
Move logic to asset deletion check
This commit is contained in:
parent
e8c5fcf64d
commit
b6631cdf1f
@ -188,7 +188,7 @@ export class AssetService extends BaseService {
|
|||||||
name: JobName.ASSET_DELETION,
|
name: JobName.ASSET_DELETION,
|
||||||
data: {
|
data: {
|
||||||
id: asset.id,
|
id: asset.id,
|
||||||
deleteOnDisk: true,
|
deleteOnDisk: !asset.isOffline,
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
@ -250,17 +250,7 @@ export class AssetService extends BaseService {
|
|||||||
const { thumbnailFile, previewFile } = getAssetFiles(asset.files);
|
const { thumbnailFile, previewFile } = getAssetFiles(asset.files);
|
||||||
const files = [thumbnailFile?.path, previewFile?.path, asset.encodedVideoPath];
|
const files = [thumbnailFile?.path, previewFile?.path, asset.encodedVideoPath];
|
||||||
|
|
||||||
let willDelete = deleteOnDisk;
|
if (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) {
|
|
||||||
files.push(asset.sidecarPath, asset.originalPath);
|
files.push(asset.sidecarPath, asset.originalPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user