Skip to content
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

Failed to match router path contains encoded string when using permalinks #1946

Closed
1 task done
fangbinwei opened this issue Oct 13, 2019 · 0 comments · Fixed by #1947 · 4 remaining pull requests
Closed
1 task done

Failed to match router path contains encoded string when using permalinks #1946

fangbinwei opened this issue Oct 13, 2019 · 0 comments · Fixed by #1947 · 4 remaining pull requests
Labels
has PR Has a related PR type: bug Something isn't working

Comments

@fangbinwei
Copy link
Contributor

  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

codesandbox link

file tree like below

.
├── 测试
│   └── README.md

I add a nav (/测试) , and I can route to the page successfully.

However, If I set permalink (e.g. /test) to the README.md, vue-router failed to match the page.

What is expected?

vue-router can match the page

What is actually happening?

when setting permalink, the router config generated like below. vue-router failed to match correct page because of the encoded path.

  {
    path: "/%E6%B5%8B%E8%AF%95/index.html",
    redirect: "/test/"
  },

the correct router config should like this

  {
    path: "/测试/index.html",
    redirect: "/test/"
  },

if (regularPath !== pagePath) {
code += `,
{
path: ${JSON.stringify(regularPath)},
redirect: ${JSON.stringify(pagePath)}
}`
}

the problem caused by these codes, regularPath is encoded

Other relevant information

I am trying to generate sidebar/nav automatically, so folder name in Chinese is a useful info to me.

  • Output of npx vuepress info in my VuePress project:
Environment Info:

  System:
    OS: macOS 10.15
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 11.12.0 - ~/.nvm/versions/node/v11.12.0/bin/node
    Yarn: 1.19.0 - /usr/local/bin/yarn
    npm: 6.7.0 - ~/.nvm/versions/node/v11.12.0/bin/npm
  Browsers:
    Chrome: 77.0.3865.90
    Firefox: Not Found
    Safari: 13.0.2
  npmPackages:
    @vuepress/core:  1.2.0 
    @vuepress/theme-default:  1.2.0 
    vuepress: ^1.0.3 => 1.2.0 
  npmGlobalPackages:
    vuepress: Not Found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment