Skip to content

Commit

Permalink
fix(express) strip query and fragment from tracing URLs (#6586)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardsimko committed May 30, 2023
1 parent b9a9390 commit a4f41aa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/tracing-internal/src/node/integrations/express.ts
@@ -1,6 +1,12 @@
/* eslint-disable max-lines */
import type { Hub, Integration, PolymorphicRequest, Transaction } from '@sentry/types';
import { extractPathForTransaction, getNumberOfUrlSegments, isRegExp, logger } from '@sentry/utils';
import {
extractPathForTransaction,
getNumberOfUrlSegments,
isRegExp,
logger,
stripUrlQueryAndFragment,
} from '@sentry/utils';

import { shouldDisableAutoInstrumentation } from './utils/node-utils';

Expand Down Expand Up @@ -335,7 +341,7 @@ function instrumentRouter(appOrRouter: ExpressRouter): void {
if (urlLength === routeLength) {
if (!req._hasParameters) {
if (req._reconstructedRoute !== req.originalUrl) {
req._reconstructedRoute = req.originalUrl;
req._reconstructedRoute = req.originalUrl ? stripUrlQueryAndFragment(req.originalUrl) : req.originalUrl;
}
}

Expand Down

0 comments on commit a4f41aa

Please sign in to comment.