Skip to content

Commit 77b8301

Browse files
authored
fix: Fallback to empty string if req.baseUrl is empty (#3329)
1 parent 2d6196b commit 77b8301

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

packages/node/src/handlers.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ function extractExpressTransactionName(
124124

125125
let path = '';
126126
if (req.route) {
127-
// if the mountpoint is `/`, req.baseUrl is '' (not undefined), so it's safe to include it here
128-
// see https://github.com/expressjs/express/blob/508936853a6e311099c9985d4c11a4b1b8f6af07/test/req.baseUrl.js#L7
129-
path = `${req.baseUrl}${req.route.path}`;
127+
path = `${req.baseUrl || ''}${req.route.path}`;
130128
} else if (req.originalUrl || req.url) {
131129
path = stripUrlQueryAndFragment(req.originalUrl || req.url || '');
132130
}

0 commit comments

Comments
 (0)