diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index fc01db47..b2fbbafb 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -108,12 +108,6 @@ export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Prom } catch(e) { console.warn("An exception occurred while processing the buffer:", e.message); } - const excludedMimetypes = ['text/plain', 'application/octet-stream', 'application/x-ms', 'application/x-msi', 'application/zip']; - - if (type && excludedMimetypes.indexOf(type.mime) === -1) { - return type.mime; - } - if (name && name.indexOf('.') > -1) { const mime = extensionToMime(name); @@ -121,6 +115,11 @@ export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Prom return mime; } } + const excludedMimetypes = ['text/plain', 'application/octet-stream', 'application/x-ms', 'application/x-msi', 'application/zip']; + + if (type && excludedMimetypes.indexOf(type.mime) === -1) { + return type.mime; + } try { if (isutf8(file)) {