Allow mimetypes with suffix in safe check (#808)

This commit is contained in:
ginnyTheCat
2022-09-04 15:45:07 +02:00
committed by GitHub
parent bdc10fb729
commit 678e0dc6ac

View 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;
}