mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-02 18:47:07 -05:00 
			
		
		
		
	fix(server): Do not change file ext case on upload (#2056)
This commit is contained in:
		
							parent
							
								
									c00624f209
								
							
						
					
					
						commit
						8adf1231a3
					
				@ -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));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user