From dd26c7cf2ad3526f224fbf9d6f9fc987bfb7f78d Mon Sep 17 00:00:00 2001 From: Binwei Fang Date: Sun, 23 Aug 2020 15:46:08 +0800 Subject: [PATCH] fix($core): decode regularPath when generate router config (fix #1946) (#1947) --- 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)} }` }