mirror of
https://github.com/immich-app/immich.git
synced 2024-11-28 09:33:27 +02:00
Removed the getMimeType function on server as shouldn't be needed anymore.
This commit is contained in:
parent
113a46ac32
commit
fc766dd0be
@ -48,23 +48,10 @@ export const multerUtils = { fileFilter, filename, destination };
|
||||
|
||||
const logger = new Logger('AssetUploadConfig');
|
||||
|
||||
function getMimeType(file: Express.Multer.File) {
|
||||
const extension = file.originalname.split('.').pop() as string;
|
||||
switch (extension.toLowerCase()) {
|
||||
case 'raf':
|
||||
return 'image/x-fuji-raf';
|
||||
case 'srw':
|
||||
return 'image/x-samsung-srw';
|
||||
default:
|
||||
return file.mimetype;
|
||||
}
|
||||
}
|
||||
|
||||
function fileFilter(req: Request, file: any, cb: any) {
|
||||
if (!req.user || (req.user.isPublicUser && !req.user.isAllowUpload)) {
|
||||
return cb(new UnauthorizedException());
|
||||
}
|
||||
file.mimetype = getMimeType(file);
|
||||
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)$/,
|
||||
|
Loading…
Reference in New Issue
Block a user