|
@@ -230,15 +230,13 @@ module.exports = class XHRUpload extends Plugin {
|
|
|
const body = opts.getResponseData(xhr.responseText, xhr)
|
|
|
const uploadURL = body[opts.responseUrlFieldName]
|
|
|
|
|
|
- const response = {
|
|
|
+ const uploadResp = {
|
|
|
status: ev.target.status,
|
|
|
body,
|
|
|
uploadURL
|
|
|
}
|
|
|
|
|
|
- // this.uppy.setFileState(file.id, { response })
|
|
|
-
|
|
|
- this.uppy.emit('upload-success', file, response)
|
|
|
+ this.uppy.emit('upload-success', file, uploadResp)
|
|
|
|
|
|
if (uploadURL) {
|
|
|
this.uppy.log(`Download ${file.name} from ${file.uploadURL}`)
|
|
@@ -246,17 +244,10 @@ module.exports = class XHRUpload extends Plugin {
|
|
|
|
|
|
return resolve(file)
|
|
|
} else {
|
|
|
- const body = opts.getResponseData(xhr.responseText, xhr)
|
|
|
+ // const body = opts.getResponseData(xhr.responseText, xhr)
|
|
|
const error = buildResponseError(xhr, opts.getResponseError(xhr.responseText, xhr))
|
|
|
|
|
|
- const response = {
|
|
|
- status: ev.target.status,
|
|
|
- body
|
|
|
- }
|
|
|
-
|
|
|
- // this.uppy.setFileState(file.id, { response })
|
|
|
-
|
|
|
- this.uppy.emit('upload-error', file, response, error)
|
|
|
+ this.uppy.emit('upload-error', file, error)
|
|
|
return reject(error)
|
|
|
}
|
|
|
})
|
|
@@ -329,13 +320,13 @@ module.exports = class XHRUpload extends Plugin {
|
|
|
const body = opts.getResponseData(data.response.responseText, data.response)
|
|
|
const uploadURL = body[opts.responseUrlFieldName]
|
|
|
|
|
|
- const response = {
|
|
|
+ const uploadResp = {
|
|
|
status: data.response.status,
|
|
|
body,
|
|
|
uploadURL
|
|
|
}
|
|
|
|
|
|
- this.uppy.emit('upload-success', file, response)
|
|
|
+ this.uppy.emit('upload-success', file, uploadResp)
|
|
|
socket.close()
|
|
|
return resolve()
|
|
|
})
|
|
@@ -402,9 +393,13 @@ module.exports = class XHRUpload extends Plugin {
|
|
|
timer.done()
|
|
|
|
|
|
if (ev.target.status >= 200 && ev.target.status < 300) {
|
|
|
- const resp = this.opts.getResponseData(xhr.responseText, xhr)
|
|
|
+ const body = this.opts.getResponseData(xhr.responseText, xhr)
|
|
|
+ const uploadResp = {
|
|
|
+ status: ev.target.status,
|
|
|
+ body
|
|
|
+ }
|
|
|
files.forEach((file) => {
|
|
|
- this.uppy.emit('upload-success', file, resp)
|
|
|
+ this.uppy.emit('upload-success', file, uploadResp)
|
|
|
})
|
|
|
return resolve()
|
|
|
}
|