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:
parent
e8c5fcf64d
commit
b6631cdf1f
1 changed files with 2 additions and 12 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue