From 730316e256015153ad20fc76faf56b82996160aa Mon Sep 17 00:00:00 2001 From: Maximilian Schmid Date: Thu, 12 Sep 2024 11:52:34 +0200 Subject: [PATCH 1/2] express 5.0.0 migration --- packages/@uppy/companion/package.json | 4 ++-- packages/@uppy/companion/src/companion.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index cf4e68c516..7452fdbc21 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -33,7 +33,7 @@ "@aws-sdk/lib-storage": "^3.338.0", "@aws-sdk/s3-presigned-post": "^3.338.0", "@aws-sdk/s3-request-presigner": "^3.338.0", - "body-parser": "1.20.2", + "body-parser": "^2.0.1", "common-tags": "1.8.2", "connect-redis": "7.1.1", "content-disposition": "^0.5.4", @@ -41,7 +41,7 @@ "cors": "^2.8.5", "escape-goat": "3.0.0", "escape-string-regexp": "4.0.0", - "express": "4.19.2", + "express": "5.0.0", "express-interceptor": "1.2.0", "express-prom-bundle": "7.0.0", "express-session": "1.18.0", diff --git a/packages/@uppy/companion/src/companion.js b/packages/@uppy/companion/src/companion.js index 01f55c2fa5..f2120e4164 100644 --- a/packages/@uppy/companion/src/companion.js +++ b/packages/@uppy/companion/src/companion.js @@ -103,7 +103,7 @@ module.exports.app = (optionsArg = {}) => { // override provider credentials at request time // Making `POST` request to the `/connect/:provider/:override?` route requires a form body parser middleware: // See https://github.com/simov/grant#dynamic-http - app.use('/connect/:oauthProvider/:override?', express.urlencoded({ extended: false }), getCredentialsOverrideMiddleware(providers, options)) + app.use('/connect/:oauthProvider/:override', express.urlencoded({ extended: false }), getCredentialsOverrideMiddleware(providers, options)) app.use(Grant(grantConfig)) app.use((req, res, next) => { @@ -117,7 +117,7 @@ module.exports.app = (optionsArg = {}) => { app.use(middlewares.cors(options)) // add uppy options to the request object so it can be accessed by subsequent handlers. - app.use('*', middlewares.getCompanionMiddleware(options)) + app.use(/(.*)/, middlewares.getCompanionMiddleware(options)) app.use('/s3', s3(options.s3)) if (options.enableUrlEndpoint) app.use('/url', url()) @@ -132,7 +132,7 @@ module.exports.app = (optionsArg = {}) => { app.post('/:providerName/simple-auth', express.json(), middlewares.hasSessionAndProvider, middlewares.hasBody, middlewares.hasSimpleAuthProvider, controllers.simpleAuth) - app.get('/:providerName/list/:id?', middlewares.hasSessionAndProvider, middlewares.verifyToken, controllers.list) + app.get('/:providerName/list/:id', middlewares.hasSessionAndProvider, middlewares.verifyToken, controllers.list) // backwards compat: app.get('/search/:providerName/list', middlewares.hasSessionAndProvider, middlewares.verifyToken, controllers.list) From 3350fc8a226673e8e2e17a3cc43acabcc613fe24 Mon Sep 17 00:00:00 2001 From: Maximilian Schmid Date: Thu, 12 Sep 2024 11:58:12 +0200 Subject: [PATCH 2/2] - remove added body-parser dep from package.json --- packages/@uppy/companion/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index 7452fdbc21..3dd3b05127 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -33,7 +33,6 @@ "@aws-sdk/lib-storage": "^3.338.0", "@aws-sdk/s3-presigned-post": "^3.338.0", "@aws-sdk/s3-request-presigner": "^3.338.0", - "body-parser": "^2.0.1", "common-tags": "1.8.2", "connect-redis": "7.1.1", "content-disposition": "^0.5.4",