diff --git a/src/util/route.js b/src/util/route.js index cc1010b45..962ebeecf 100644 --- a/src/util/route.js +++ b/src/util/route.js @@ -1,11 +1,12 @@ /* @flow */ +const trailingSlashRE = /\/$/ export function isSameRoute (a: Route, b: ?Route): boolean { if (!b) { return false } else if (a.path && b.path) { return ( - a.path === b.path && + a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') && a.hash === b.hash && isObjectEqual(a.query, b.query) ) diff --git a/test/unit/specs/route.spec.js b/test/unit/specs/route.spec.js index 013de3ab1..6fb1da783 100644 --- a/test/unit/specs/route.spec.js +++ b/test/unit/specs/route.spec.js @@ -9,7 +9,7 @@ describe('Route utils', () => { query: { foo: 'bar', arr: [1, 2] } } const b = { - path: '/a', + path: '/a/', // Allow trailing slash hash: '#hi', query: { arr: ['1', '2'], foo: 'bar' } }