Переглянути джерело

@uppy/xhr-upload: do not throw when res is missing url (#5132)

Merlijn Vos 11 місяців тому
батько
коміт
2a15ba5128
1 змінених файлів з 3 додано та 6 видалено
  1. 3 6
      packages/@uppy/xhr-upload/src/index.ts

+ 3 - 6
packages/@uppy/xhr-upload/src/index.ts

@@ -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, {