diff --git a/ui/litellm-dashboard/src/utils/tabRoutes.test.ts b/ui/litellm-dashboard/src/utils/tabRoutes.test.ts index 402be55c33a..7165b67addc 100644 --- a/ui/litellm-dashboard/src/utils/tabRoutes.test.ts +++ b/ui/litellm-dashboard/src/utils/tabRoutes.test.ts @@ -25,6 +25,11 @@ describe("createTabRoutes.slugFromPathname", () => { it("returns empty string when the base segment is not in the path", () => { expect(routes.slugFromPathname("/teams")).toBe(""); }); + + it("reads the route base after a server-root prefix that repeats the segment name", () => { + expect(routes.slugFromPathname("/logs/ui/logs/audit/")).toBe("audit"); + expect(routes.slugFromPathname("/logs/ui/logs/")).toBe(""); + }); }); describe("createTabRoutes.tabHref", () => { diff --git a/ui/litellm-dashboard/src/utils/tabRoutes.ts b/ui/litellm-dashboard/src/utils/tabRoutes.ts index f27b1f5d49f..ecd52250556 100644 --- a/ui/litellm-dashboard/src/utils/tabRoutes.ts +++ b/ui/litellm-dashboard/src/utils/tabRoutes.ts @@ -15,7 +15,7 @@ export function createTabRoutes(baseSegment: string, slugs: const slugFromPathname = (pathname: string): string => { const parts = pathname.split("/").filter(Boolean); - const idx = parts.indexOf(baseSegment); + const idx = parts.lastIndexOf(baseSegment); if (idx === -1) { return ""; }