Explorar el Código

@uppy/companion-client: fix `TypeError`

`companionUrl` might be undefined if not provided by the user.
Antoine du Hamel hace 1 año
padre
commit
c2cb2a3a58
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      packages/@uppy/companion-client/src/Provider.js

+ 1 - 1
packages/@uppy/companion-client/src/Provider.js

@@ -286,7 +286,7 @@ export default class Provider extends RequestClient {
       plugin.opts.companionAllowedHosts = pattern
     } else if (/^(?!https?:\/\/).*$/i.test(opts.companionUrl)) {
       // does not start with https://
-      plugin.opts.companionAllowedHosts = `https://${opts.companionUrl.replace(/^\/\//, '')}`
+      plugin.opts.companionAllowedHosts = `https://${opts.companionUrl?.replace(/^\/\//, '')}`
     } else {
       plugin.opts.companionAllowedHosts = new URL(opts.companionUrl).origin
     }