Fix crash with unknown mime type
authorAjay Bura <32841439+ajbura@users.noreply.github.com>
Wed, 7 Sep 2022 03:10:10 +0000 (08:40 +0530)
committerAjay Bura <32841439+ajbura@users.noreply.github.com>
Wed, 7 Sep 2022 03:10:10 +0000 (08:40 +0530)
src/util/mimetypes.js

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