Skip to content

Commit

Permalink
fix(getMimetype): Check x-msi by an extension (#280)
Browse files Browse the repository at this point in the history
* fix(getMimetype): Check x-msi by an extension

* feat(export): export getMimetype function
  • Loading branch information
AndrzejSala authored and pcholuj committed Oct 7, 2019
1 parent 35cca80 commit 3e4c35b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { UploadOptions } from './lib/api/upload/types';
import { StoreUploadOptions } from './lib/api/upload';
import { PreviewOptions } from './lib/api/preview';
import { FilestackError } from './filestack_error';
import { getMimetype } from './lib/utils/index';

/**
* Initialize client with given config
Expand Down Expand Up @@ -67,5 +68,6 @@ export {
PickerResponse,
Client,
FilestackError,
PickerDisplayMode
PickerDisplayMode,
getMimetype
};
4 changes: 2 additions & 2 deletions src/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ export const md5 = (data: any): string => {
export const getMimetype = (file: Uint8Array | Buffer, name?: string): string => {
let type = fileType(file);

// check x-ms by extension
if (type && type.mime !== 'application/x-ms') {
// check x-ms and x-msi by extension
if (type && (type.mime !== 'application/x-ms' && type.mime !== 'application/x-msi')) {
return type.mime;
}

Expand Down

0 comments on commit 3e4c35b

Please sign in to comment.