Skip to content

Missing param due to case-sensitive token regex #2925

Closed
@pimlie

Description

@pimlie

Version

3.1.3

Reproduction link

https://jsfiddle.net/j4s8ka1v/

Steps to reproduce

Unfortunately the above reproduction link does not reproduce the issue, not sure why the tokensToFunction method isnt used in the jsfiddle. But I've traced the issue to tokensToFunction from path-to-regexp. The issue seems to have been fixed in v3.1.0 due to this pr. You can check eg dist/vue-router.esm.js to see the RegExp does not set the i modifier

That makes this report more or less a fyi / request to upgrade path-to-regexp 😃

Locally the error is caused by a route similar to

  routes: [{
      path: "/:locale(en|pt-br)?/:source(.*)?",
      component: myComponent,
    }],

which fails when you browse to e.g. /pt-BR/path:

image

What is expected?

That the token / param is matched case-insensitively

What is actually happening?

It doesnt, causing a missing param error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions