fix(generator): decode path with ufo (#9739)

This commit is contained in:
Daniel Roe 2021-09-07 17:40:15 +01:00 committed by GitHub
parent dc0e1b9ad7
commit dfcc26e3b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ import fsExtra from 'fs-extra'
import defu from 'defu'
import htmlMinifier from 'html-minifier'
import { parse } from 'node-html-parser'
import { withTrailingSlash, withoutTrailingSlash } from 'ufo'
import { withTrailingSlash, withoutTrailingSlash, decode } from 'ufo'
import { isFullStatic, flatRoutes, isString, isUrl, promisifyRoute, urlJoin, waitFor, requireModule } from '@nuxt/utils'
@ -353,7 +353,7 @@ or disable the build step: \`generate({ build: false })\``)
// Save Static Assets
if (this.staticAssetsDir && renderContext.staticAssets) {
for (const asset of renderContext.staticAssets) {
const assetPath = path.join(this.staticAssetsDir, decodeURI(asset.path))
const assetPath = path.join(this.staticAssetsDir, decode(asset.path))
await fsExtra.ensureDir(path.dirname(assetPath))
await fsExtra.writeFile(assetPath, asset.src, 'utf-8')
}