Skip to content

Commit

Permalink
check if file has name, required for react-dropzone pull-request #594
Browse files Browse the repository at this point in the history
  • Loading branch information
veerabio authored and quarklemotion committed Apr 18, 2018
1 parent 6a3d1f4 commit 5baef89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Html5FileSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function traverseDirectory(entry) {
function packageFile(file, entry) {
let fileTypeOverride = '';
// handle some browsers sometimes missing mime types for dropped files
const hasExtension = file.name.lastIndexOf('.') !== -1;
const hasExtension = file.name && file.name.lastIndexOf('.') !== -1;
if (hasExtension && !file.type) {
fileTypeOverride = mimeTypes.lookup(file.name);
}
Expand Down Expand Up @@ -122,7 +122,6 @@ export function getDataTransferFiles(dataTransfer) {
* and subfolders of the dropped/selected items.
*/
export function getDroppedOrSelectedFiles(event) {

const dataTransfer = event.dataTransfer;
if (dataTransfer && dataTransfer.items) {
return getDataTransferFiles(dataTransfer).then((fileList) => {
Expand Down
2 changes: 1 addition & 1 deletion test/Html5FileSelctorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { expect } from 'chai';
import Html5FileSelector from '../src/Html5FileSelector';
import * as Html5FileSelector from '../src/Html5FileSelector';
require('babel-polyfill');

const MOCK_MEDIA_FILES = [
Expand Down

0 comments on commit 5baef89

Please sign in to comment.