mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 02:27:08 -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,24 +98,30 @@ export class MediaService { | |||||||
|     if (!asset) { |     if (!asset) { | ||||||
|       return false; |       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) { |     if (asset.resizePath) { | ||||||
|  |       const resizePath = this.ensureThumbnailPath(asset, 'jpeg'); | ||||||
|  |       if (asset.resizePath !== resizePath) { | ||||||
|         await this.storageRepository.moveFile(asset.resizePath, resizePath); |         await this.storageRepository.moveFile(asset.resizePath, resizePath); | ||||||
|         await this.assetRepository.save({ id: asset.id, resizePath }); |         await this.assetRepository.save({ id: asset.id, resizePath }); | ||||||
|       } |       } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     if (asset.webpPath && asset.webpPath !== webpPath) { |     if (asset.webpPath) { | ||||||
|  |       const webpPath = this.ensureThumbnailPath(asset, 'webp'); | ||||||
|  |       if (asset.webpPath !== webpPath) { | ||||||
|         await this.storageRepository.moveFile(asset.webpPath, webpPath); |         await this.storageRepository.moveFile(asset.webpPath, webpPath); | ||||||
|         await this.assetRepository.save({ id: asset.id, webpPath }); |         await this.assetRepository.save({ id: asset.id, webpPath }); | ||||||
|       } |       } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     if (asset.encodedVideoPath && asset.encodedVideoPath !== encodedVideoPath) { |     if (asset.encodedVideoPath) { | ||||||
|  |       const encodedVideoPath = this.ensureEncodedVideoPath(asset, 'mp4'); | ||||||
|  |       if (asset.encodedVideoPath !== encodedVideoPath) { | ||||||
|         await this.storageRepository.moveFile(asset.encodedVideoPath, encodedVideoPath); |         await this.storageRepository.moveFile(asset.encodedVideoPath, encodedVideoPath); | ||||||
|         await this.assetRepository.save({ id: asset.id, encodedVideoPath }); |         await this.assetRepository.save({ id: asset.id, encodedVideoPath }); | ||||||
|       } |       } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     return true; |     return true; | ||||||
|   } |   } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user