From: ginnyTheCat Date: Sun, 4 Sep 2022 13:45:07 +0000 (+0200) Subject: Allow mimetypes with suffix in safe check (#808) X-Git-Tag: v2.2.0~36 X-Git-Url: https://git.wafflesoft.org/?a=commitdiff_plain;h=678e0dc6accae03399e89d35d81cb193ca3f772a;p=cinny.git Allow mimetypes with suffix in safe check (#808) --- 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; }