Skip to content

When MIME type cannot be determined, set sensible default#233

Open
shaungallagher wants to merge 1 commit intoodysseyscience:masterfrom
shaungallagher:patch-2
Open

When MIME type cannot be determined, set sensible default#233
shaungallagher wants to merge 1 commit intoodysseyscience:masterfrom
shaungallagher:patch-2

Conversation

@shaungallagher
Copy link

It is possible for getFileMimeType to return false if it is unable to determine the file type. When that happens, an error occurs in React S3 Uploader: Uncaught TypeError: fileType.substr is not a function.

To resolve this issue, the mime-types package recommends that a default be set:

Instead of naively returning the first available type, mime-types simply returns false, so do var type = mime.lookup('unrecognized') || 'application/octet-stream'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments