Skip to content

Commit

Permalink
Move logic to asset deletion check
Browse files Browse the repository at this point in the history
  • Loading branch information
etnoy committed Dec 19, 2024
1 parent e8c5fcf commit b6631cd
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions server/src/services/asset.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class AssetService extends BaseService {
name: JobName.ASSET_DELETION,
data: {
id: asset.id,
deleteOnDisk: true,
deleteOnDisk: !asset.isOffline,
},
})),
);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit b6631cd

Please sign in to comment.