-
-
Notifications
You must be signed in to change notification settings - Fork 829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HAS PR #508] File not uploading in Edge browser, stalls at "Uploading" stage (no percentage) #507
Comments
…ermining if a file has loaded, since in my testing, Edge is presenting a `File` object at this stage, rather than the `Blob` that Chrome etc are presenting (fixes pqina#507). * If `createFileProcessorFunction` is presented with a file object that is not of type `Blob` (such as `File`, as seen in Edge browser), it attempts to iterate over it using `forEach` as if it were an iterable object, however `File` objects do not have a `forEach` method. Resolve this by treating all file object input into this function as though they are a singular, non-iterable object (fixes pqina#507). * Fix comment typo.
Interestingly, the first example upload form at https://pqina.nl/filepond/#examples does work for me in Edge, so there is obviously some issue somewhere between however that example is configured and build, and my own React project. I think my changes in PR #508 are still worthy of consideration regardless. |
@dannya Thanks so much for your effort, I will look into this as soon as possible. |
@dannya It looks like the |
Thanks for your investigation into this @rikschennink, I can confirm that removing the Blob polyfill resolves the issue. That said, I think the changes in my PR (aside from the comment typo and console.log) are still relevant, with the key change being a simplification to using the existing |
Describe the bug
In Microsoft Edge on Windows 10 (Microsoft EdgeHTML 18.19631, Microsoft Edge 44.19631.1.0), when trying to upload a file using FilePond, once the file is selected, the status doesn't proceed past the "Uploading" state with spinner in the UI. There are no console messages, and no AJAX request is made to my /upload endpoint.
File status stays at
PROCESSING (3)
This same example works fine in Chrome and Firefox.
My project is using the Rollup bundler, but in reproducing this, I disabled treeshaking and terser minification.
For completeness, my project is loading the following polyfills in Edge (the server returns only the polyfills needed by the requesting browser):
https://cdn.polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.every,Array.prototype.filter,Array.prototype.find,Array.prototype.findIndex,Array.prototype.forEach,Array.prototype.includes,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.some,Array.prototype.values,ArrayBuffer,atob,Blob,console,CustomEvent,DataView,Date.now,document,fetch,Function.prototype.bind,globalThis,Int8Array,JSON,Map,Math.sign,modernizr:es5object,Number.isSafeInteger,Object.assign,Object.freeze,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.is,Object.setPrototypeOf,Object.values,Promise,requestAnimationFrame,Set,String.prototype.includes,String.prototype.padStart,String.prototype.repeat,String.prototype.trim,Symbol,Symbol.asyncIterator,Symbol.for,Symbol.iterator,Uint8Array,URL,WeakMap,WeakSet,XMLHttpRequest
Logs
I've delved into the FilePond library and found that the difference between the working Chrome browser and the not-working Edge browser can be pinpointed to this line:
starting at line 228 in
src/js/app/utils/createItem.js
.In Chrome, this code block is entered, since state.file is a
Blob
object.In Edge, this code block is not entered, since it is a
File
object.This can be resolved with the following change (using an existing utility function used elsewhere in the code for the file check):
Once this code is fixed, there is a second code issue blocking uploads.
Starting at line 39 in
src/js/app/utils/createFileProcessorFunction.js
:My understanding of the parent
createFileProcessorFunction
that this code resides in (based on the variable names, code structure, etc), is that this function only ever deals with a single file object (whether that beBlob
,File
, or something else) - therefore, the operation of a forEach in the right side of the ternary (whenfile
is not aBlob
) is not correct, since iffile
is aFile
, it does not have theforEach
method.Changing this code as follows has resolved my issue in both Edge and Chrome:
(it can be simplified further if indeed this parent function only operates on a single file, as the
forEach
is redundant in this case).To Reproduce
I am using filepond-react (though the error is happening inside the main filepond library).
Upload a file (in my case, an .xlsx file).
Error happens both on localhost server development version and online HTTPS hosted version.
Here is my React component (with added logging of every lifecycle event):
Expected behavior
File should be uploaded in Edge, matching the behaviour shown in browsers such as Chrome.
Stacktraces
With the above full logging, here is the different outputs:
Edge (not working)
Chrome (working)
Information about your project:
The text was updated successfully, but these errors were encountered: