Skip to content

Commit

Permalink
@uppy/xhr-upload: do not throw when res is missing url (#5132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon authored May 2, 2024
1 parent 4028a6d commit 2a15ba5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/@uppy/xhr-upload/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,9 @@ export default class XHRUpload<
}

const body = this.opts.getResponseData(res.responseText, res)
const uploadURL = body[this.opts.responseUrlFieldName]
if (typeof uploadURL !== 'string') {
throw new Error(
`The received response did not include a valid URL for key ${this.opts.responseUrlFieldName}`,
)
}
const uploadURL = body?.[this.opts.responseUrlFieldName] as
| string
| undefined

for (const file of files) {
this.uppy.emit('upload-success', file, {
Expand Down

0 comments on commit 2a15ba5

Please sign in to comment.