From dfcc26e3b71a893ef04d49f9bd3adbbf235a0b15 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 7 Sep 2021 17:40:15 +0100 Subject: [PATCH] fix(generator): decode path with `ufo` (#9739) --- packages/generator/src/generator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/generator/src/generator.js b/packages/generator/src/generator.js index 9ce2cfae3d..aaae213670 100644 --- a/packages/generator/src/generator.js +++ b/packages/generator/src/generator.js @@ -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') }