From 48c78fbb70453eaf700dabb976b03cbe11a5a5ff Mon Sep 17 00:00:00 2001 From: doly mood Date: Wed, 7 Jan 2015 12:42:15 +0800 Subject: [PATCH] fix ie10+ hangs indefinitely IE10+, if file's size is 0 then skip the file. I think this is a good way to fix it. --- src/flow.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/flow.js b/src/flow.js index 4cb39880..3d18db7d 100644 --- a/src/flow.js +++ b/src/flow.js @@ -2,7 +2,8 @@ * @license MIT */ (function(window, document, undefined) {'use strict'; - + // ie10+ + var ie10plus = window.navigator.msPointerEnabled; /** * Flow.js is a library providing multiple simultaneous, stable and * resumable uploads via the HTML5 File API. @@ -562,9 +563,11 @@ addFiles: function (fileList, event) { var files = []; each(fileList, function (file) { + // Uploading empty file IE10/IE11 hangs indefinitely + // see https://connect.microsoft.com/IE/feedback/details/813443/uploading-empty-file-ie10-ie11-hangs-indefinitely // Directories have size `0` and name `.` // Ignore already added files - if (!(file.size % 4096 === 0 && (file.name === '.' || file.fileName === '.')) && + if ((!ie10plus || ie10plus && file.size > 0) && !(file.size % 4096 === 0 && (file.name === '.' || file.fileName === '.')) && !this.getFromUniqueIdentifier(this.generateUniqueIdentifier(file))) { var f = new FlowFile(this, file); if (this.fire('fileAdded', f, event)) {