From 678e0dc6accae03399e89d35d81cb193ca3f772a Mon Sep 17 00:00:00 2001 From: ginnyTheCat Date: Sun, 4 Sep 2022 15:45:07 +0200 Subject: [PATCH] Allow mimetypes with suffix in safe check (#808) --- src/util/mimetypes.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/mimetypes.js b/src/util/mimetypes.js index 121ae06..7a94e0c 100644 --- a/src/util/mimetypes.js +++ b/src/util/mimetypes.js @@ -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; }