We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 823bf66 commit 98d15a1Copy full SHA for 98d15a1
packages/router-core/src/path.ts
@@ -36,7 +36,8 @@ export function trimPathLeft(path: string) {
36
/** Trim trailing slashes (except preserving root '/'). */
37
38
export function trimPathRight(path: string) {
39
- return path === '/' ? path : path.replace(/\/{1,}$/, '')
+ const len = path.length
40
+ return len > 1 && path[len - 1] === '/' ? path.replace(/\/{1,}$/, '') : path
41
}
42
43
/** Trim both leading and trailing slashes. */
0 commit comments