Skip to content

Commit e1849e9

Browse files
authored
Allow trailing slashes in path comparison (fix #628)
1 parent 3c7f007 commit e1849e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util/route.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/* @flow */
2+
const trailingSlashRE = /\/$/
23

34
export function isSameRoute (a: Route, b: ?Route): boolean {
45
if (!b) {
56
return false
67
} else if (a.path && b.path) {
78
return (
8-
a.path === b.path &&
9+
a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
910
a.hash === b.hash &&
1011
isObjectEqual(a.query, b.query)
1112
)

0 commit comments

Comments
 (0)