uppy icon indicating copy to clipboard operation
uppy copied to clipboard

getResponseData() fails when responseType is set to 'blob'

Open hgchrre opened this issue 3 years ago • 5 comments

When using the XHR Upload plugin, setting the responseType to 'blob' instead of default 'text' leads to the plugin failing with the following error:

Capture

It seems to be an issue with the way the plugin handles xhr.responseText if there is none:

Capture2

hgchrre avatar Aug 05 '20 16:08 hgchrre

Yep…the default implementations of getResponse{Data,Error} should probably return null if the responseText is empty/not a string.

goto-bus-stop avatar Aug 06 '20 12:08 goto-bus-stop

Do you mind if I submit a PR to fix this?

ajkachnic avatar Aug 17 '20 12:08 ajkachnic

Okay so I think that if I change all instances of xhr.responseText to xhr.response in the main file of XHR-Upload, it works fine. I tested it with a route that returns JSON and temporarily added a route to the xhr-bundle example which sends back the same file that was sent. Both function well, if you pass a custom getResponseData function

EDIT: I can pretty easily configure the default getResponseData function to work with both, currently testing that

ajkachnic avatar Aug 17 '20 13:08 ajkachnic

@ajkachnic how is that implementation going? Are you willing to finish it? If not could you go over the changes to make it easy for others to pickup what you already thought out?

Murderlon avatar Jun 29 '21 09:06 Murderlon

We got the same issue.

Any progress?

DoonPort0422 avatar Feb 11 '22 07:02 DoonPort0422

Any one working on this bug? I am happy to fix this with a PR.

Genuifx avatar Dec 11 '22 14:12 Genuifx

PRs are very welcome! :)

Murderlon avatar Dec 13 '22 13:12 Murderlon