1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-16 03:40:33 +02:00

Add support for many missing raw formats (#2834)

* Allow upload of AVIF and x-canon-cr2 mime types

* Allow generic RAW file mime type image/x-dcraw

* Another place to uploading avif and cr2

* Determine mime type for .avif and .cr2 files correctly

* Update asset-upload.config.spec.ts for CR2 and AVIF files

* More changes for AVIF & CR2 files

Found some other places where avif and cr2 should be mentioned.

* Merge in upstream changes

* Allow uploading and using most of the formats that libraw supports

* Add raw files to allowable mobile uploads

* Update asset-upload.config.spec.ts

Fix errant commas.

* Update asset-utils.ts

Remove duplicate entry in hash table.

* Fix missing k25 mime type in server upload check.
Fix prettier formatting message in web file-uploader.

* fix test

---------

Co-authored-by: Elliot Lee <sopwith@gmail.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Elliot Lee
2023-06-19 22:10:29 -04:00
committed by GitHub
parent c404ea20ee
commit 81e2b18531
6 changed files with 129 additions and 4 deletions

View File

@ -131,11 +131,34 @@ export function getFileMimeType(file: File): string {
dng: 'image/dng',
heic: 'image/heic',
heif: 'image/heif',
avif: 'image/avif',
insp: 'image/jpeg',
insv: 'video/mp4',
nef: 'image/x-nikon-nef',
raf: 'image/x-fuji-raf',
srw: 'image/x-samsung-srw'
srw: 'image/x-samsung-srw',
crw: 'image/x-canon-crw',
cr2: 'image/x-canon-cr2',
cr3: 'image/x-canon-cr3',
erf: 'image/x-epson-erf',
dcr: 'image/x-kodak-dcr',
k25: 'image/x-kodak-k25',
kdc: 'image/x-kodak-kdc',
mrw: 'image/x-minolta-mrw',
orf: 'image/x-olympus-orf',
raw: 'image/x-panasonic-raw',
pef: 'image/x-pentax-pef',
x3f: 'image/x-sigma-x3f',
srf: 'image/x-sony-srf',
sr2: 'image/x-sony-sr2',
'3fr': 'image/x-hasselblad-3fr',
fff: 'image/x-hasselblad-fff',
rwl: 'image/x-leica-rwl',
ori: 'image/x-olympus-ori',
iiq: 'image/x-phaseone-iiq',
ari: 'image/x-arriflex-ari',
cap: 'image/x-phaseone-cap',
cin: 'image/x-phantom-cin'
};
// Return the MIME type determined by the browser or the MIME type based on the file extension.
return file.type || (mimeTypes[getFilenameExtension(file.name)] ?? '');