Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: fix regex issue (#8393)

Amlan Kumar Nandy53c58b998313
diff --git a/frontend/src/components/RouteTab/index.tsx b/frontend/src/components/RouteTab/index.tsx
index be717c26aa..f47124bb64 100644
--- a/frontend/src/components/RouteTab/index.tsx
+++ b/frontend/src/components/RouteTab/index.tsx
@@ -1,4 +1,5 @@
import { Tabs, TabsProps } from 'antd';
+import { escapeRegExp } from 'lodash-es';
import { useLocation, useParams } from 'react-router-dom';
import { RouteTabProps } from './types';
@@ -28,7 +29,11 @@ function RouteTab({
// Find the matching route for the current pathname
const currentRoute = routesWithParams.find((route) => {
- const routePattern = route.route.replace(/:(\w+)/g, '([^/]+)');
+ const pathnameOnly = route.route.split('?')[0];
+ const routePattern = escapeRegExp(pathnameOnly).replace(
+ /\\:([a-zA-Z0-9_]+)/g,
+ '([^/]+)',
+ );
const regex = new RegExp(`^${routePattern}$`);
return regex.test(location.pathname);
});