Allow mimetypes with suffix in safe check (#808)
This commit is contained in:
parent
bdc10fb729
commit
678e0dc6ac
1 changed files with 4 additions and 3 deletions
|
@ -26,12 +26,13 @@ export const ALLOWED_BLOB_MIMETYPES = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export function getBlobSafeMimeType(mimetype) {
|
export function getBlobSafeMimeType(mimetype) {
|
||||||
if (!ALLOWED_BLOB_MIMETYPES.includes(mimetype)) {
|
const [type] = mimetype.split(';');
|
||||||
|
if (!ALLOWED_BLOB_MIMETYPES.includes(type)) {
|
||||||
return 'application/octet-stream';
|
return 'application/octet-stream';
|
||||||
}
|
}
|
||||||
// Required for Chromium browsers
|
// Required for Chromium browsers
|
||||||
if (mimetype === 'video/quicktime') {
|
if (type === 'video/quicktime') {
|
||||||
return 'video/mp4';
|
return 'video/mp4';
|
||||||
}
|
}
|
||||||
return mimetype;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue