High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(server): Do not change file ext case on upload (#2056)
bo0tzz8adf1231a30d
diff --git a/server/apps/immich/src/config/asset-upload.config.spec.ts b/server/apps/immich/src/config/asset-upload.config.spec.tsindex 89e698ff6c..fbe4d20f91 100644--- a/server/apps/immich/src/config/asset-upload.config.spec.ts+++ b/server/apps/immich/src/config/asset-upload.config.spec.ts@@ -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();+ });});});diff --git a/server/apps/immich/src/config/asset-upload.config.ts b/server/apps/immich/src/config/asset-upload.config.tsindex d1449c470c..a262b3023e 100644--- a/server/apps/immich/src/config/asset-upload.config.ts+++ b/server/apps/immich/src/config/asset-upload.config.ts@@ -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));}