Skip to content

Commit feb695d

Browse files
fix(ui): replace regex with string methods for basePath stripping
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 55fd85f commit feb695d

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/ui/src/components/utm-persistence.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,9 @@ export function UtmPersistence({
113113
const internalPathname = basePath
114114
? targetUrl.pathname === basePath
115115
? "/"
116-
: targetUrl.pathname.replace(
117-
new RegExp(`^${basePath}(?:/|$)`),
118-
"/",
119-
)
116+
: targetUrl.pathname.startsWith(`${basePath}/`)
117+
? targetUrl.pathname.slice(basePath.length)
118+
: targetUrl.pathname
120119
: targetUrl.pathname;
121120

122121
event.preventDefault();

0 commit comments

Comments
 (0)