diff --git a/packages/router-core/src/path.ts b/packages/router-core/src/path.ts index da410e9c7d..f6fada8e57 100644 --- a/packages/router-core/src/path.ts +++ b/packages/router-core/src/path.ts @@ -22,7 +22,8 @@ export function joinPaths(paths: Array) { /** Remove repeated slashes from a path string. */ export function cleanPath(path: string) { - // remove double slashes + // Most paths never contain '//' — skip the regex on that common case. + if (path.indexOf('//') === -1) return path return path.replace(/\/{2,}/g, '/') }