Skip to content

Commit 1df9019

Browse files
committed
improve comments
1 parent 726cdcf commit 1df9019

File tree

1 file changed

+3
-3
lines changed
  • plugins/node/opentelemetry-instrumentation-express/src

1 file changed

+3
-3
lines changed

plugins/node/opentelemetry-instrumentation-express/src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,12 @@ export function getConstructedRoute(req: {
226226
path => path !== '/' && path !== '/*'
227227
);
228228

229-
// Handle standalone wildcard case
230229
if (meaningfulPaths.length === 1 && meaningfulPaths[0] === '*') {
231230
return '*';
232231
}
233232

234-
// Construct the route by joining paths and normalizing
235-
return meaningfulPaths.join('').replace(/\/{2,}/g, '/'); // Remove duplicate slashes
233+
// Join parts and remove duplicate slashes
234+
return meaningfulPaths.join('').replace(/\/{2,}/g, '/');
236235
}
237236

238237
/**
@@ -257,6 +256,7 @@ export function getActualMatchedRoute(req: {
257256
}
258257

259258
// Handle root path case - if all paths are root, only return root if originalUrl is also root
259+
// The layer store also includes root paths in case a non-existing url was requested
260260
if (layersStore.every(path => path === '/')) {
261261
return req.originalUrl === '/' ? '/' : undefined;
262262
}

0 commit comments

Comments
 (0)