Skip to content

Commit

Permalink
Fix getFileType for dicom images (#3610)
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon authored Apr 14, 2022
1 parent a889afc commit 03b5441
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/@uppy/utils/src/getFileType.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,19 @@ describe('getFileType', () => {
name: 'bar.mkv',
data: 'sdfsfhfh329fhwihs',
}
const fileDicom = {
name: 'bar.dicom',
data: 'sdfsfhfh329fhwihs',
}
const toUpper = (file) => ({ ...file, name: file.name.toUpperCase() })
expect(getFileType(fileMP3)).toEqual('audio/mp3')
expect(getFileType(toUpper(fileMP3))).toEqual('audio/mp3')
expect(getFileType(fileYAML)).toEqual('text/yaml')
expect(getFileType(toUpper(fileYAML))).toEqual('text/yaml')
expect(getFileType(fileMKV)).toEqual('video/x-matroska')
expect(getFileType(toUpper(fileMKV))).toEqual('video/x-matroska')
expect(getFileType(fileDicom)).toEqual('application/dicom')
expect(getFileType(toUpper(fileDicom))).toEqual('application/dicom')
})

it('should fail gracefully if unable to detect', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/@uppy/utils/src/mimeTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
mks: 'video/x-matroska',
mkv: 'video/x-matroska',
mov: 'video/quicktime',
dicom: 'application/dicom',
doc: 'application/msword',
docm: 'application/vnd.ms-word.document.macroenabled.12',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
Expand Down

0 comments on commit 03b5441

Please sign in to comment.