Skip to content

Commit

Permalink
fix(mimetypes): if we have mimetype and we cant find excluded type by…
Browse files Browse the repository at this point in the history
… extension fallback to magic by
  • Loading branch information
pcholuj committed Oct 1, 2020
1 parent 77fa52d commit 20cfa49
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ export const getMimetype = (file: Uint8Array | Buffer, name?: string): string =>
}
// this is only fallback, omit it in coverage
/* istanbul ignore next */

// if we cant find types by extensions and we have magic bytes fallback to it
if (type) {
return type.mime;
}

return 'application/octet-stream';
};

Expand Down

0 comments on commit 20cfa49

Please sign in to comment.