You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Active Storage, upload a file directly to a service (tested with local and s3) using Internet Explorer 11.
Expected behavior
The file should be properly uploaded via javascript directly to the service.
Actual behavior
A Unable to get property 'url' of undefined or null reference is thrown:
This is due to a bug in IE 11: when using a XMLHttpRequest with xhr.responseType = "json", IE 11 will not automatically parse the response body (see here).
The faulty code line is here, when the property direct_upload is read from the response, an undefined is returned since reponse is a string and not an object.
I did workaround this by simply checking if the response body is a string and parse it with JSON.parse.
I can submit this fix but I'm not sure if Active Storage should support IE 11 or not. If that's not the case, feel free to close this issue.
@10io IE11 is the latest version of IE, right? I'm pretty sure that, in that case, ActiveSupport supports/should-support IE11. (I'm no rails maintainer.)
I'd suggest that you create a PR.
Steps to reproduce
Using Active Storage, upload a file directly to a service (tested with local and s3) using Internet Explorer 11.
Expected behavior
The file should be properly uploaded via javascript directly to the service.
Actual behavior
A
Unable to get property 'url' of undefined or null reference
is thrown:This is due to a bug in IE 11: when using a XMLHttpRequest with
xhr.responseType = "json"
, IE 11 will not automatically parse the response body (see here).The faulty code line is here, when the property
direct_upload
is read from theresponse
, anundefined
is returned sincereponse
is a string and not an object.I did workaround this by simply checking if the response body is a string and parse it with
JSON.parse
.I can submit this fix but I'm not sure if Active Storage should support IE 11 or not. If that's not the case, feel free to close this issue.
System configuration
Rails version:
5.2.0.alpha 5c7e59a
Ruby version:
ruby 2.4.2
The text was updated successfully, but these errors were encountered: