mirror of
https://github.com/immich-app/immich.git
synced 2025-01-07 00:50:23 -05:00
fix(server): remove encoded video file on asset delete (#1980)
* add check for encoded video file to be deleted with asset * remove unnecessary code and adjust test * complete test * fix unit test * fix unit test properly this time * fix formatting --------- Co-authored-by: Sebastian Schöttl <sebastian.schoettl@cybertechnologies.com>
This commit is contained in:
parent
532bd6fe12
commit
01afeefeb9
2 changed files with 14 additions and 2 deletions
|
@ -412,7 +412,16 @@ describe('AssetService', () => {
|
||||||
expect(jobMock.queue).toHaveBeenCalledWith({
|
expect(jobMock.queue).toHaveBeenCalledWith({
|
||||||
name: JobName.DELETE_FILES,
|
name: JobName.DELETE_FILES,
|
||||||
data: {
|
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',
|
originalPath: 'original-path-2',
|
||||||
resizePath: 'resize-path-2',
|
resizePath: 'resize-path-2',
|
||||||
webpPath: 'web-path-2',
|
webpPath: 'web-path-2',
|
||||||
|
encodedVideoPath: 'encoded-video-path-2',
|
||||||
};
|
};
|
||||||
|
|
||||||
when(assetRepositoryMock.get)
|
when(assetRepositoryMock.get)
|
||||||
|
@ -455,9 +465,11 @@ describe('AssetService', () => {
|
||||||
'original-path-1',
|
'original-path-1',
|
||||||
'web-path-1',
|
'web-path-1',
|
||||||
'resize-path-1',
|
'resize-path-1',
|
||||||
|
undefined,
|
||||||
'original-path-2',
|
'original-path-2',
|
||||||
'web-path-2',
|
'web-path-2',
|
||||||
'resize-path-2',
|
'resize-path-2',
|
||||||
|
'encoded-video-path-2',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -430,7 +430,7 @@ export class AssetService {
|
||||||
await this.jobRepository.queue({ name: JobName.SEARCH_REMOVE_ASSET, data: { id } });
|
await this.jobRepository.queue({ name: JobName.SEARCH_REMOVE_ASSET, data: { id } });
|
||||||
|
|
||||||
result.push({ id, status: DeleteAssetStatusEnum.SUCCESS });
|
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
|
// TODO refactor this to use cascades
|
||||||
if (asset.livePhotoVideoId && !ids.includes(asset.livePhotoVideoId)) {
|
if (asset.livePhotoVideoId && !ids.includes(asset.livePhotoVideoId)) {
|
||||||
|
|
Loading…
Reference in a new issue