From 82e4c2dc5fa62be60876da7bb0ec271a921954bc Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 28 Jun 2021 15:28:46 +0100 Subject: [PATCH] fix(vue-renderer): decode route path for `payload.js` (#9494) [release] --- packages/vue-renderer/src/renderers/ssr.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vue-renderer/src/renderers/ssr.js b/packages/vue-renderer/src/renderers/ssr.js index 543c1f5c04..ed7aba75bf 100644 --- a/packages/vue-renderer/src/renderers/ssr.js +++ b/packages/vue-renderer/src/renderers/ssr.js @@ -4,7 +4,7 @@ import { format } from 'util' import fs from 'fs-extra' import consola from 'consola' import { TARGETS, urlJoin } from '@nuxt/utils' -import { parsePath, withoutTrailingSlash } from 'ufo' +import { decode, parsePath, withoutTrailingSlash } from 'ufo' import devalue from '@nuxt/devalue' import { createBundleRenderer } from 'vue-server-renderer' import BaseRenderer from './base' @@ -210,7 +210,7 @@ export default class SSRRenderer extends BaseRenderer { // Page level payload.js (async loaded for CSR) const payloadPath = urlJoin(url, 'payload.js') const payloadUrl = urlJoin(staticAssetsBase, payloadPath) - const routePath = withoutTrailingSlash(parsePath(url).pathname) + const routePath = withoutTrailingSlash(decode(parsePath(url).pathname)) const payloadScript = `__NUXT_JSONP__("${routePath}", ${devalue({ data, fetch, mutations })});` staticAssets.push({ path: payloadPath, src: payloadScript }) preloadScripts.push(payloadUrl)