Skip to content

Commit 93b2ca1

Browse files
shigmaulivz
authored andcommitted
feat($core): decode page path for better readablility (#1438)
1 parent f516cb4 commit 93b2ca1

File tree

1 file changed

+3
-3
lines changed
  • packages/@vuepress/core/lib/node/build

1 file changed

+3
-3
lines changed

packages/@vuepress/core/lib/node/build/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ module.exports = class Build extends EventEmitter {
133133
*/
134134

135135
async renderPage (page) {
136-
const pagePath = page.path
136+
const pagePath = decodeURIComponent(page.path)
137137
readline.clearLine(process.stdout, 0)
138138
readline.cursorTo(process.stdout, 0)
139139
process.stdout.write(`Rendering page: ${pagePath}`)
@@ -143,7 +143,7 @@ module.exports = class Build extends EventEmitter {
143143
const pageMeta = renderPageMeta(meta)
144144

145145
const context = {
146-
url: pagePath,
146+
url: page.path,
147147
userHeadTags: this.userHeadTags,
148148
pageMeta,
149149
title: 'VuePress',
@@ -158,7 +158,7 @@ module.exports = class Build extends EventEmitter {
158158
console.error(logger.error(chalk.red(`Error rendering ${pagePath}:`), false))
159159
throw e
160160
}
161-
const filename = decodeURIComponent(pagePath.replace(/\/$/, '/index.html').replace(/^\//, ''))
161+
const filename = pagePath.replace(/\/$/, '/index.html').replace(/^\//, '')
162162
const filePath = path.resolve(this.outDir, filename)
163163
await fs.ensureDir(path.dirname(filePath))
164164
await fs.writeFile(filePath, html)

0 commit comments

Comments
 (0)