Skip to content

Avoid an error when a root '/' for VueRouter is specified (fix #379) #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2016

Conversation

tejitak
Copy link
Contributor

@tejitak tejitak commented Mar 23, 2016

This is reported in #379
The reproduce step is just specifying '/' as root like below.

const router = new VueRouter({
  history: true,
  saveScrollPosition: true,
  root: '/'
})

You can see "Invalid regular expression: /^\/: \ at end of pattern".

The root param '/' is not needed and we can just remove it to work as expected, but I think it's better to avoid a runtime error when it's explicitly specified.

@blake-newman
Copy link
Member

Code is good, however can you add some tests to cover this scenario.

@yyx990803 yyx990803 merged commit bb20060 into vuejs:dev Mar 23, 2016
@tejitak tejitak deleted the issue-379 branch March 28, 2016 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants