From 9dd1d81536ef668996b632bc4d3049cb9df27ddd Mon Sep 17 00:00:00 2001 From: Elliot Lee <39544852+elliotclee@users.noreply.github.com> Date: Sun, 25 Jun 2023 14:10:39 -0400 Subject: [PATCH] Allow Windows' version of the MIME types for raw photos. (#2945) * Allow Windows' version of the MIME types for raw photos. * Fix prettier warning. --------- Co-authored-by: Elliot Lee --- server/src/domain/domain.constant.ts | 27 +++++++++++++++++ .../immich/config/asset-upload.config.spec.ts | 28 ++++++++++++++++++ web/src/lib/utils/asset-utils.spec.ts | 29 +++++++++++++++++++ 3 files changed, 84 insertions(+) diff --git a/server/src/domain/domain.constant.ts b/server/src/domain/domain.constant.ts index 5e741e5d45..c691d7be6f 100644 --- a/server/src/domain/domain.constant.ts +++ b/server/src/domain/domain.constant.ts @@ -67,6 +67,33 @@ const validMimeTypes = [ 'image/x-sony-arw', 'image/x-sony-sr2', 'image/x-sony-srf', + 'image/dng', + 'image/ari', + 'image/cr2', + 'image/cr3', + 'image/crw', + 'image/erf', + 'image/raf', + 'image/3fr', + 'image/fff', + 'image/dcr', + 'image/k25', + 'image/kdc', + 'image/rwl', + 'image/mrw', + 'image/nef', + 'image/orf', + 'image/ori', + 'image/raw', + 'image/pef', + 'image/cin', + 'image/cap', + 'image/iiq', + 'image/srw', + 'image/x3f', + 'image/arw', + 'image/sr2', + 'image/srf', 'video/3gpp', 'video/mp2t', 'video/mp4', diff --git a/server/src/immich/config/asset-upload.config.spec.ts b/server/src/immich/config/asset-upload.config.spec.ts index 6978547f1e..783cd0d75e 100644 --- a/server/src/immich/config/asset-upload.config.spec.ts +++ b/server/src/immich/config/asset-upload.config.spec.ts @@ -87,6 +87,34 @@ describe('assetUploadOption', () => { { mimetype: 'image/x-sony-arw', extension: 'arw' }, { mimetype: 'image/x-sony-sr2', extension: 'sr2' }, { mimetype: 'image/x-sony-srf', extension: 'srf' }, + + { mimetype: 'image/dng', extension: 'dng' }, + { mimetype: 'image/ari', extension: 'ari' }, + { mimetype: 'image/cr2', extension: 'cr2' }, + { mimetype: 'image/cr3', extension: 'cr3' }, + { mimetype: 'image/crw', extension: 'crw' }, + { mimetype: 'image/erf', extension: 'erf' }, + { mimetype: 'image/raf', extension: 'raf' }, + { mimetype: 'image/3fr', extension: '3fr' }, + { mimetype: 'image/fff', extension: 'fff' }, + { mimetype: 'image/dcr', extension: 'dcr' }, + { mimetype: 'image/k25', extension: 'k25' }, + { mimetype: 'image/kdc', extension: 'kdc' }, + { mimetype: 'image/rwl', extension: 'rwl' }, + { mimetype: 'image/mrw', extension: 'mrw' }, + { mimetype: 'image/nef', extension: 'nef' }, + { mimetype: 'image/orf', extension: 'orf' }, + { mimetype: 'image/ori', extension: 'ori' }, + { mimetype: 'image/raw', extension: 'raw' }, + { mimetype: 'image/pef', extension: 'pef' }, + { mimetype: 'image/cin', extension: 'cin' }, + { mimetype: 'image/cap', extension: 'cap' }, + { mimetype: 'image/iiq', extension: 'iiq' }, + { mimetype: 'image/srw', extension: 'srw' }, + { mimetype: 'image/x3f', extension: 'x3f' }, + { mimetype: 'image/arw', extension: 'arw' }, + { mimetype: 'image/sr2', extension: 'sr2' }, + { mimetype: 'image/srf', extension: 'srf' }, { mimetype: 'video/3gpp', extension: '3gp' }, { mimetype: 'video/mp2t', extension: 'm2ts' }, { mimetype: 'video/mp2t', extension: 'mts' }, diff --git a/web/src/lib/utils/asset-utils.spec.ts b/web/src/lib/utils/asset-utils.spec.ts index e458bf03d6..341b89c1aa 100644 --- a/web/src/lib/utils/asset-utils.spec.ts +++ b/web/src/lib/utils/asset-utils.spec.ts @@ -98,6 +98,35 @@ describe('get file mime type', () => { { mimetype: 'image/x-sony-arw', extension: 'arw' }, { mimetype: 'image/x-sony-sr2', extension: 'sr2' }, { mimetype: 'image/x-sony-srf', extension: 'srf' }, + /*** The following MIME types are allowed for upload but not returned by getFileMimeType() *** + { mimetype: 'image/dng', extension: 'dng' }, + { mimetype: 'image/ari', extension: 'ari' }, + { mimetype: 'image/cr2', extension: 'cr2' }, + { mimetype: 'image/cr3', extension: 'cr3' }, + { mimetype: 'image/crw', extension: 'crw' }, + { mimetype: 'image/erf', extension: 'erf' }, + { mimetype: 'image/raf', extension: 'raf' }, + { mimetype: 'image/3fr', extension: '3fr' }, + { mimetype: 'image/fff', extension: 'fff' }, + { mimetype: 'image/dcr', extension: 'dcr' }, + { mimetype: 'image/k25', extension: 'k25' }, + { mimetype: 'image/kdc', extension: 'kdc' }, + { mimetype: 'image/rwl', extension: 'rwl' }, + { mimetype: 'image/mrw', extension: 'mrw' }, + { mimetype: 'image/nef', extension: 'nef' }, + { mimetype: 'image/orf', extension: 'orf' }, + { mimetype: 'image/ori', extension: 'ori' }, + { mimetype: 'image/raw', extension: 'raw' }, + { mimetype: 'image/pef', extension: 'pef' }, + { mimetype: 'image/cin', extension: 'cin' }, + { mimetype: 'image/cap', extension: 'cap' }, + { mimetype: 'image/iiq', extension: 'iiq' }, + { mimetype: 'image/srw', extension: 'srw' }, + { mimetype: 'image/x3f', extension: 'x3f' }, + { mimetype: 'image/arw', extension: 'arw' }, + { mimetype: 'image/sr2', extension: 'sr2' }, + { mimetype: 'image/srf', extension: 'srf' }, +**/ { mimetype: 'video/3gpp', extension: '3gp' }, { mimetype: 'video/mp2t', extension: 'm2ts' }, { mimetype: 'video/mp2t', extension: 'mts' },