From b6631cdf1fcf4a54dc28816e4243f31bf8ddcc04 Mon Sep 17 00:00:00 2001 From: Jonathan Jogenfors Date: Thu, 19 Dec 2024 14:48:43 +0100 Subject: [PATCH] Move logic to asset deletion check --- server/src/services/asset.service.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/server/src/services/asset.service.ts b/server/src/services/asset.service.ts index c676b44414..cb568948a3 100644 --- a/server/src/services/asset.service.ts +++ b/server/src/services/asset.service.ts @@ -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); }