Allow mimetypes with suffix in safe check (#808)
authorginnyTheCat <ginnythecat@lelux.net>
Sun, 4 Sep 2022 13:45:07 +0000 (15:45 +0200)
committerGitHub <noreply@github.com>
Sun, 4 Sep 2022 13:45:07 +0000 (19:15 +0530)
src/util/mimetypes.js

index 121ae0699bb546689692357f418b17437a679f09..7a94e0c8618fc084907a5fff2c648aa1dd55d299 100644 (file)
@@ -26,12 +26,13 @@ export const ALLOWED_BLOB_MIMETYPES = [
 ];
 
 export function getBlobSafeMimeType(mimetype) {
-  if (!ALLOWED_BLOB_MIMETYPES.includes(mimetype)) {
+  const [type] = mimetype.split(';');
+  if (!ALLOWED_BLOB_MIMETYPES.includes(type)) {
     return 'application/octet-stream';
   }
   // Required for Chromium browsers
-  if (mimetype === 'video/quicktime') {
+  if (type === 'video/quicktime') {
     return 'video/mp4';
   }
-  return mimetype;
+  return type;
 }