Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-singh-filestack committed Jan 4, 2024
1 parent a3d7103 commit 5d77046
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ export const uniqueId = (len: number = 10): string => {
* @returns {string} - mimetype
*/
export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Promise<string> => {
let type = await fromBuffer(file);

const excludedMimetypes = ['text/plain', 'application/x-ms', 'application/x-msi', 'application/zip'];
let type;
try{
type = await fromBuffer(file);
}catch(e){
return 'application/octet-stream'
}
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;
Expand Down

0 comments on commit 5d77046

Please sign in to comment.