Skip to content

Commit 20cfa49

Browse files
committed
fix(mimetypes): if we have mimetype and we cant find excluded type by extension fallback to magic by
1 parent 77fa52d commit 20cfa49

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib/utils/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ export const getMimetype = (file: Uint8Array | Buffer, name?: string): string =>
132132
}
133133
// this is only fallback, omit it in coverage
134134
/* istanbul ignore next */
135+
136+
// if we cant find types by extensions and we have magic bytes fallback to it
137+
if (type) {
138+
return type.mime;
139+
}
140+
135141
return 'application/octet-stream';
136142
};
137143

0 commit comments

Comments
 (0)