High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(server): expand tests and add avi, mov to mimetypes. (#2213)
Skyler Mäntysaarifb42a736f18d
diff --git a/server/apps/immich/src/config/asset-upload.config.spec.ts b/server/apps/immich/src/config/asset-upload.config.spec.tsindex a01a0983d4..715a3a7aca 100644--- a/server/apps/immich/src/config/asset-upload.config.spec.ts+++ b/server/apps/immich/src/config/asset-upload.config.spec.ts@@ -102,6 +102,24 @@ describe('assetUploadOption', () => {expect(callback).toHaveBeenCalledWith(null, true);});+ it('should allow .mov videos with video/mov mimetype', () => {+ const file = { mimetype: 'video/mov', originalname: 'test.mov' } as any;+ fileFilter(mock.userRequest, file, callback);+ expect(callback).toHaveBeenCalledWith(null, true);+ });++ it('should allow .avi videos with video/avi mimetype', () => {+ const file = { mimetype: 'video/avi', originalname: 'test.avi' } as any;+ fileFilter(mock.userRequest, file, callback);+ expect(callback).toHaveBeenCalledWith(null, true);+ });++ it('should allow .avi videos with video/x-msvideo mimetype', () => {+ const file = { mimetype: 'video/x-msvideo', originalname: 'test.avi' } as any;+ fileFilter(mock.userRequest, file, callback);+ expect(callback).toHaveBeenCalledWith(null, true);+ });+it('should not allow unknown types', async () => {const file = { mimetype: 'application/html', originalname: 'test.html' } as any;const callback = jest.fn();diff --git a/server/apps/immich/src/config/asset-upload.config.ts b/server/apps/immich/src/config/asset-upload.config.tsindex 6a4f6804e5..6568a2dce1 100644--- a/server/apps/immich/src/config/asset-upload.config.ts+++ b/server/apps/immich/src/config/asset-upload.config.ts@@ -56,7 +56,7 @@ function fileFilter(req: Request, file: any, cb: any) {}if (file.mimetype.match(- /\/(jpg|jpeg|png|gif|mp4|webm|x-msvideo|quicktime|heic|heif|dng|x-adobe-dng|webp|tiff|3gpp|nef|x-nikon-nef|x-fuji-raf|x-samsung-srw|mpeg|x-flv|x-ms-wmv|x-matroska)$/,+ /\/(jpg|jpeg|png|gif|avi|mov|mp4|webm|x-msvideo|quicktime|heic|heif|dng|x-adobe-dng|webp|tiff|3gpp|nef|x-nikon-nef|x-fuji-raf|x-samsung-srw|mpeg|x-flv|x-ms-wmv|x-matroska)$/,)) {cb(null, true);