Skip to content

High performance self-hosted photo and video management solution.

fix(server): remove encoded video file on asset delete (#1980)

raisinbear01afeefeb9c8
diff --git a/server/apps/immich/src/api-v1/asset/asset.service.spec.ts b/server/apps/immich/src/api-v1/asset/asset.service.spec.ts
index e7d8760594..6d2e5f5abb 100644
--- a/server/apps/immich/src/api-v1/asset/asset.service.spec.ts
+++ b/server/apps/immich/src/api-v1/asset/asset.service.spec.ts
@@ -412,7 +412,16 @@ describe('AssetService', () => {
expect(jobMock.queue).toHaveBeenCalledWith({
name: JobName.DELETE_FILES,
data: {
- files: ['fake_path/asset_1.jpeg', undefined, undefined, 'fake_path/asset_1.mp4', undefined, undefined],
+ files: [
+ 'fake_path/asset_1.jpeg',
+ undefined,
+ undefined,
+ undefined,
+ 'fake_path/asset_1.mp4',
+ undefined,
+ undefined,
+ undefined,
+ ],
},
});
});
@@ -430,6 +439,7 @@ describe('AssetService', () => {
originalPath: 'original-path-2',
resizePath: 'resize-path-2',
webpPath: 'web-path-2',
+ encodedVideoPath: 'encoded-video-path-2',
};
when(assetRepositoryMock.get)
@@ -455,9 +465,11 @@ describe('AssetService', () => {
'original-path-1',
'web-path-1',
'resize-path-1',
+ undefined,
'original-path-2',
'web-path-2',
'resize-path-2',
+ 'encoded-video-path-2',
],
},
},
diff --git a/server/apps/immich/src/api-v1/asset/asset.service.ts b/server/apps/immich/src/api-v1/asset/asset.service.ts
index a04ec8a646..f3070637d6 100644
--- a/server/apps/immich/src/api-v1/asset/asset.service.ts
+++ b/server/apps/immich/src/api-v1/asset/asset.service.ts
@@ -430,7 +430,7 @@ export class AssetService {
await this.jobRepository.queue({ name: JobName.SEARCH_REMOVE_ASSET, data: { id } });
result.push({ id, status: DeleteAssetStatusEnum.SUCCESS });
- deleteQueue.push(asset.originalPath, asset.webpPath, asset.resizePath);
+ deleteQueue.push(asset.originalPath, asset.webpPath, asset.resizePath, asset.encodedVideoPath);
// TODO refactor this to use cascades
if (asset.livePhotoVideoId && !ids.includes(asset.livePhotoVideoId)) {