Skip to content

Commit 6592b20

Browse files
committed
improve comments
1 parent a49a39b commit 6592b20

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
@@ -220,13 +220,12 @@ export function getConstructedRoute(req: {
220220
path => path !== '/' && path !== '/*'
221221
);
222222

223-
// Handle standalone wildcard case
224223
if (meaningfulPaths.length === 1 && meaningfulPaths[0] === '*') {
225224
return '*';
226225
}
227226

228-
// Construct the route by joining paths and normalizing
229-
return meaningfulPaths.join('').replace(/\/{2,}/g, '/'); // Remove duplicate slashes
227+
// Join parts and remove duplicate slashes
228+
return meaningfulPaths.join('').replace(/\/{2,}/g, '/');
230229
}
231230

232231
/**
@@ -251,6 +250,7 @@ export function getActualMatchedRoute(req: {
251250
}
252251

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

0 commit comments

Comments
 (0)