diff options
author | _N_I_X_O_N_ <lazaronixon@hotmail.com> | 2017-09-12 14:35:33 -0300 |
---|---|---|
committer | lazaronixon <lazaronixon@hotmail.com> | 2017-09-12 18:45:23 +0000 |
commit | c06b614c12ad763859609079222945bd68a7852b (patch) | |
tree | fdfa91e63b665a5c15d1104b0eb0a2beb5738171 /activestorage/app/javascript/activestorage | |
parent | 5af7d475c8cd7d3dbffca7452f3dcb221896e8e5 (diff) | |
download | rails-c06b614c12ad763859609079222945bd68a7852b.tar.gz rails-c06b614c12ad763859609079222945bd68a7852b.tar.bz2 rails-c06b614c12ad763859609079222945bd68a7852b.zip |
Fix activestorage direct upload on firefox
Direct upload on firefox is not working because it can’t handle click
events on “input[type=submit]”.
After a successful upload we can see on console a xml parse error, it
happens because AWS S3 success body response is empty, so changing the
reponseType suppress this error.
Diffstat (limited to 'activestorage/app/javascript/activestorage')
-rw-r--r-- | activestorage/app/javascript/activestorage/blob_upload.js | 1 | ||||
-rw-r--r-- | activestorage/app/javascript/activestorage/ujs.js | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/activestorage/app/javascript/activestorage/blob_upload.js b/activestorage/app/javascript/activestorage/blob_upload.js index 99bf0c9e30..180a7415e7 100644 --- a/activestorage/app/javascript/activestorage/blob_upload.js +++ b/activestorage/app/javascript/activestorage/blob_upload.js @@ -7,6 +7,7 @@ export class BlobUpload { this.xhr = new XMLHttpRequest this.xhr.open("PUT", url, true) + this.xhr.responseType = "text" for (const key in headers) { this.xhr.setRequestHeader(key, headers[key]) } diff --git a/activestorage/app/javascript/activestorage/ujs.js b/activestorage/app/javascript/activestorage/ujs.js index a2ce2cfc58..1dda02936f 100644 --- a/activestorage/app/javascript/activestorage/ujs.js +++ b/activestorage/app/javascript/activestorage/ujs.js @@ -53,6 +53,7 @@ function submitForm(form) { if (button) { const { disabled } = button button.disabled = false + button.focus() button.click() button.disabled = disabled } else { |