MediaService: Only allow upload of common image formats and PDFs

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-10-17 20:50:20 +02:00
parent d41b68b41a
commit c2c51f1eef
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -26,8 +26,22 @@ export class MediaService {
}
private static isAllowedMimeType(mimeType: string): boolean {
//TODO: Which mimetypes are allowed?
return true;
const allowedTypes = [
'application/pdf',
'image/apng',
'image/bmp',
'image/gif',
'image/heif',
'image/heic',
'image/heif-sequence',
'image/heic-sequence',
'image/jpeg',
'image/png',
'image/svg+xml',
'image/tiff',
'image/webp',
];
return allowedTypes.includes(mimeType);
}
public async saveFile(file: MulterFile, username: string, noteId: string) {