Skip to content

slashes should not be encoded for catch all regexes #1638

Open
@keith0305

Description

Version

4.1.6

Reproduction link

codesandbox.io

Steps to reproduce

  1. Load the codesandbox.io project using the link provided.
  2. Click on About page.
  3. Click on the "Add hash" button, this will call router.replace({ hash: '#something' }).
  4. Notice that vue-router correctly appends the # in the url. (https://domain.com/about.html#yippy).
  5. Click on Deep About page.
  6. Click on the "Add hash" button.
  7. Notice that the url becomes https://domain.com/test%2Fdeep%2Fabout.html#yaya.

What is expected?

Url to become https://domain.com/test/deep/about.html#yaya

What is actually happening?

Url became https://domain.com/test%2Fdeep%2Fabout.html#yaya

image


This is for the front-end of a CMS-supported project, where the front part of the URL is controlled by the CMS and it varies depending on the environment. Hence the need to first match it using :pathMatch() then match the actual page to render using :pageName().

Also, all pages has to be suffixed with .html, hence I am using a (kind of) complex regex to match the page. It works, however, I stumble upon this issue.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status

      📆 Planned

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions