mirror of
https://github.com/immich-app/immich.git
synced 2025-03-01 15:11:21 +01:00
Removed the getMimeType function on server as shouldn't be needed anymore.
This commit is contained in:
parent
113a46ac32
commit
fc766dd0be
1 changed files with 0 additions and 13 deletions
|
@ -48,23 +48,10 @@ export const multerUtils = { fileFilter, filename, destination };
|
||||||
|
|
||||||
const logger = new Logger('AssetUploadConfig');
|
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) {
|
function fileFilter(req: Request, file: any, cb: any) {
|
||||||
if (!req.user || (req.user.isPublicUser && !req.user.isAllowUpload)) {
|
if (!req.user || (req.user.isPublicUser && !req.user.isAllowUpload)) {
|
||||||
return cb(new UnauthorizedException());
|
return cb(new UnauthorizedException());
|
||||||
}
|
}
|
||||||
file.mimetype = getMimeType(file);
|
|
||||||
if (
|
if (
|
||||||
file.mimetype.match(
|
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)$/,
|
/\/(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…
Add table
Reference in a new issue