Skip to content

Commit e2df878

Browse files
committed
fix(utils): getFileExtensionFromUri should return extension not a mime-type
1 parent 85b6d18 commit e2df878

File tree

1 file changed

+3
-2
lines changed
  • packages/uikit-utils/src/shared

1 file changed

+3
-2
lines changed

packages/uikit-utils/src/shared/file.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ export function getFileExtension(filePath: string) {
195195
else return result;
196196
}
197197

198-
export function getFileExtensionFromUri(uri: string) {
199-
return fetch(uri).then((response) => response.headers.get('content-type'));
198+
export async function getFileExtensionFromUri(uri: string) {
199+
const type = await fetch(uri).then((response) => response.headers.get('content-type'));
200+
return getFileExtensionFromMime(type);
200201
}
201202

202203
export function isImage(filePath: string, mimeType?: string) {

0 commit comments

Comments
 (0)