mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	fix(server): Do not change file ext case on upload (#2056)
This commit is contained in:
		| @@ -179,5 +179,18 @@ describe('assetUploadOption', () => { | ||||
|       expect(error).toBeNull(); | ||||
|       expect(name.endsWith(mock.userRequest.body.fileExtension)).toBeTruthy(); | ||||
|     }); | ||||
|  | ||||
|     it('should not change the casing of the extension', () => { | ||||
|       // Case is deliberately mixed to cover both .upper() and .lower() | ||||
|       const body = { ...mock.userRequest.body, fileExtension: '.JpEg' }; | ||||
|       const request = { ...mock.userRequest, body } as Request; | ||||
|  | ||||
|       filename(request, mock.file, callback); | ||||
|  | ||||
|       expect(callback).toHaveBeenCalled(); | ||||
|       const [error, name] = callback.mock.calls[0]; | ||||
|       expect(error).toBeNull(); | ||||
|       expect(name.endsWith(body.fileExtension)).toBeTruthy(); | ||||
|     }); | ||||
|   }); | ||||
| }); | ||||
|   | ||||
| @@ -97,6 +97,6 @@ function filename(req: Request, file: Express.Multer.File, cb: any) { | ||||
|     return cb(null, sanitize(livePhotoFileName)); | ||||
|   } | ||||
|  | ||||
|   const fileName = `${fileNameUUID}${req.body['fileExtension'].toLowerCase()}`; | ||||
|   const fileName = `${fileNameUUID}${req.body['fileExtension']}`; | ||||
|   return cb(null, sanitize(fileName)); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user