From ffdc8074f0ba31c5f0f0a96fef678c7acccc16d3 Mon Sep 17 00:00:00 2001 From: fangbinwei Date: Sun, 13 Oct 2019 22:25:48 +0800 Subject: [PATCH] fix($core): decode regularPath when generate router config vue-router can't match path contains encoded string like Chinese, when using permalink. fix #1946 --- packages/@vuepress/core/lib/node/internal-plugins/routes.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/@vuepress/core/lib/node/internal-plugins/routes.js b/packages/@vuepress/core/lib/node/internal-plugins/routes.js index d6cf90b9b1..b3635efb0d 100644 --- a/packages/@vuepress/core/lib/node/internal-plugins/routes.js +++ b/packages/@vuepress/core/lib/node/internal-plugins/routes.js @@ -65,10 +65,12 @@ function routesCode (pages) { }` } - if (regularPath !== pagePath) { + const decodedRegularPath = decodeURIComponent(regularPath) + + if (decodedRegularPath !== pagePath) { code += `, { - path: ${JSON.stringify(regularPath)}, + path: ${JSON.stringify(decodedRegularPath)}, redirect: ${JSON.stringify(pagePath)} }` }