mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00: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:
		| @@ -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', | ||||
|               ], | ||||
|             }, | ||||
|           }, | ||||
|   | ||||
| @@ -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)) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user