Procházet zdrojové kódy

crash if trying to set path to / (#5003)

* crash if trying to set path to /

fixes #4271

* Update packages/@uppy/companion/src/config/companion.js
Mikael Finstad před 1 rokem
rodič
revize
4f2abc59d4

+ 7 - 1
packages/@uppy/companion/src/config/companion.js

@@ -86,7 +86,13 @@ const validateConfig = (companionOptions) => {
     )
   }
 
-  const { providerOptions, periodicPingUrls } = companionOptions
+  const { providerOptions, periodicPingUrls, server } = companionOptions
+
+  if (server && server.path) {
+    // see https://github.com/transloadit/uppy/issues/4271
+    // todo fix the code so we can allow `/`
+    if (server.path === '/') throw new Error('server.path cannot be set to /')
+  }
 
   if (providerOptions) {
     const deprecatedOptions = { microsoft: 'providerOptions.onedrive', google: 'providerOptions.drive', s3: 's3' }