mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 02:39:03 -04:00 
			
		
		
		
	fix(server): Thumbnail migration creating unnecessary directories (#4251)
* fix: during migration folders will be created before checking if needed * refactor
This commit is contained in:
		
							parent
							
								
									85efbc6984
								
							
						
					
					
						commit
						cc70f5f6a0
					
				| @ -98,23 +98,29 @@ export class MediaService { | ||||
|     if (!asset) { | ||||
|       return false; | ||||
|     } | ||||
|     const resizePath = this.ensureThumbnailPath(asset, 'jpeg'); | ||||
|     const webpPath = this.ensureThumbnailPath(asset, 'webp'); | ||||
|     const encodedVideoPath = this.ensureEncodedVideoPath(asset, 'mp4'); | ||||
| 
 | ||||
|     if (asset.resizePath && asset.resizePath !== resizePath) { | ||||
|       await this.storageRepository.moveFile(asset.resizePath, resizePath); | ||||
|       await this.assetRepository.save({ id: asset.id, resizePath }); | ||||
|     if (asset.resizePath) { | ||||
|       const resizePath = this.ensureThumbnailPath(asset, 'jpeg'); | ||||
|       if (asset.resizePath !== resizePath) { | ||||
|         await this.storageRepository.moveFile(asset.resizePath, resizePath); | ||||
|         await this.assetRepository.save({ id: asset.id, resizePath }); | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     if (asset.webpPath && asset.webpPath !== webpPath) { | ||||
|       await this.storageRepository.moveFile(asset.webpPath, webpPath); | ||||
|       await this.assetRepository.save({ id: asset.id, webpPath }); | ||||
|     if (asset.webpPath) { | ||||
|       const webpPath = this.ensureThumbnailPath(asset, 'webp'); | ||||
|       if (asset.webpPath !== webpPath) { | ||||
|         await this.storageRepository.moveFile(asset.webpPath, webpPath); | ||||
|         await this.assetRepository.save({ id: asset.id, webpPath }); | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     if (asset.encodedVideoPath && asset.encodedVideoPath !== encodedVideoPath) { | ||||
|       await this.storageRepository.moveFile(asset.encodedVideoPath, encodedVideoPath); | ||||
|       await this.assetRepository.save({ id: asset.id, encodedVideoPath }); | ||||
|     if (asset.encodedVideoPath) { | ||||
|       const encodedVideoPath = this.ensureEncodedVideoPath(asset, 'mp4'); | ||||
|       if (asset.encodedVideoPath !== encodedVideoPath) { | ||||
|         await this.storageRepository.moveFile(asset.encodedVideoPath, encodedVideoPath); | ||||
|         await this.assetRepository.save({ id: asset.id, encodedVideoPath }); | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user