Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/traverseFileTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ function loopFiles(item: InternalDataTransferItem, callback) {
const traverseFileTree = (files: InternalDataTransferItem[], callback, isAccepted) => {
// eslint-disable-next-line @typescript-eslint/naming-convention
const _traverseFileTree = (item: InternalDataTransferItem, path?: string) => {
if (!item) {
return;
}
// eslint-disable-next-line no-param-reassign
item.path = path || '';
if (item.isFile) {
Expand Down
16 changes: 16 additions & 0 deletions tests/uploader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,22 @@ describe('uploader', () => {
}, 100);
});

it('dragging and dropping a non file with a file does not prevent the file from being uploaded', done => {
const input = uploader.find('input').first();
const file = {
name: 'success.png',
};
input.simulate('drop', {
dataTransfer: { items: [{ webkitGetAsEntry: () => null }, makeDataTransferItem(file)] },
});
const mockStart = jest.fn();
handlers.onStart = mockStart;
setTimeout(() => {
expect(mockStart.mock.calls.length).toBe(1);
done();
}, 100);
});

it('unaccepted type files to upload will not trigger onStart when select directory', done => {
const input = uploader.find('input').first();
const files = [
Expand Down