From 1c2ed524037afe132dc9234f37dd0529831bb007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Tue, 16 Mar 2021 12:48:23 +0100 Subject: [PATCH] fix: Fallback to empty string if req.baseUrl is empty --- packages/node/src/handlers.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/node/src/handlers.ts b/packages/node/src/handlers.ts index 0d347c158b4a..191228dfb374 100644 --- a/packages/node/src/handlers.ts +++ b/packages/node/src/handlers.ts @@ -124,9 +124,7 @@ function extractExpressTransactionName( let path = ''; if (req.route) { - // if the mountpoint is `/`, req.baseUrl is '' (not undefined), so it's safe to include it here - // see https://github.com/expressjs/express/blob/508936853a6e311099c9985d4c11a4b1b8f6af07/test/req.baseUrl.js#L7 - path = `${req.baseUrl}${req.route.path}`; + path = `${req.baseUrl || ''}${req.route.path}`; } else if (req.originalUrl || req.url) { path = stripUrlQueryAndFragment(req.originalUrl || req.url || ''); }