Fix crash with unknown mime type

This commit is contained in:
Ajay Bura 2022-09-07 08:40:10 +05:30
parent 19f674cf5f
commit 2ded7d9b1f

View file

@ -26,6 +26,7 @@ export const ALLOWED_BLOB_MIMETYPES = [
]; ];
export function getBlobSafeMimeType(mimetype) { export function getBlobSafeMimeType(mimetype) {
if (typeof mimetype !== 'string') return 'application/octet-stream';
const [type] = mimetype.split(';'); const [type] = mimetype.split(';');
if (!ALLOWED_BLOB_MIMETYPES.includes(type)) { if (!ALLOWED_BLOB_MIMETYPES.includes(type)) {
return 'application/octet-stream'; return 'application/octet-stream';