Skip to content

Encoding custom paths breaks RegExps (introduced in #145) #191

@tronstoner

Description

@tronstoner

Version

v5.3.0

Reproduction link

https://github.com/tronstoner/nuxt-i18n-bugreport

Steps to reproduce

1- git clone https://github.com/tronstoner/nuxt-i18n-bugreport.git
2- npm install
3- npm run dev
4- open console in browser
4- go to http://127.0.0.1:3000
5- Error: [vue-router] missing param for named route "foo-id___de": Expected "id" to match "%5Cd+", but received "666"

What is expected ?

RegExps in custom paths in translations should be left untouched.

What is actually happening?

encodeURI() breaks custom paths. e.g:

"/foo/:slug-:id(\\d+)"
becomes:
"/en/foo/:slug-:id(%5Cd+)"

A change introduced in:
98c9945

Additional comments?

I would be happy if for now encodeURI could be an just option (default: true), so we could simply take care of URI encoding ourselves before pushing paths to the router.

This bug report is available on Nuxt community (#c191)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions