Quellcode durchsuchen

@uppy/companion: fix `TypeError` when parsing request (#5303)

The previous version was creating the opportunity for a TypeError when
assumptions on the client request were not met.
Antoine du Hamel vor 9 Monaten
Ursprung
Commit
f1ffda2743
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      packages/@uppy/companion/src/server/controllers/connect.js

+ 1 - 1
packages/@uppy/companion/src/server/controllers/connect.js

@@ -25,7 +25,7 @@ module.exports = function connect(req, res) {
   } else if (oauthOrigin && oauthOrigin.length < 2) {
     // eslint-disable-next-line prefer-destructuring
     stateObj.origin = oauthOrigin[0]
-  } else {
+  } else if (req.query.state) {
     // If we have multiple allowed origins, we need to check the client-supplied origin from query.
     // If the client provides an untrusted origin,
     // we want to send `undefined`. `undefined` means `/`, which is the same origin when passed to `postMessage`.