Skip to content

Commit 0a4e894

Browse files
committed
fix: add HEIC/HEIF MIME type support in normalizeFile
1 parent d685271 commit 0a4e894

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/uikit-react-native/src/__tests__/utils/normalizeFile.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ describe('normalizeFile', () => {
4949

5050
const invalidResult = await normalizeFile({ uri: 'uri', size: null, name: 'fromName.pdf', type: 'invalid' });
5151
expect(invalidResult).toStrictEqual({ uri: 'uri', size: 0, name: 'fromName.pdf', type: 'application/pdf' });
52+
53+
const heicResult = await normalizeFile({ uri: 'uri', size: null, name: 'fromName.heic', type: null });
54+
expect(heicResult).toStrictEqual({ uri: 'uri', size: 0, name: 'fromName.heic', type: 'image/heic' });
55+
56+
const heifResult = await normalizeFile({ uri: 'uri', size: null, name: 'fromName.heif', type: null });
57+
expect(heifResult).toStrictEqual({ uri: 'uri', size: 0, name: 'fromName.heif', type: 'image/heif' });
5258
});
5359

5460
it('should get type from uri if name and type are invalid', async () => {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const EXTENSION_MIME_MAP = {
66
'gif': 'image/gif',
77
'webp': 'image/webp',
88
'svg': 'image/svg+xml',
9+
'heic': 'image/heic',
10+
'heif': 'image/heif',
911

1012
// Video
1113
'3gp': 'video/3gpp',

0 commit comments

Comments
 (0)