From 34d1a96007103cca1cad27bf74de92952f911544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petter=20Walb=C3=B8=20Johnsg=C3=A5rd?= Date: Thu, 8 Jul 2021 23:10:09 +0200 Subject: [PATCH] Admin PWA: Encode manifest data (#33310) Fixes spaces in site title without replacing them with non breaking spaces. --- packages/admin-manifest/src/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/admin-manifest/src/index.js b/packages/admin-manifest/src/index.js index 5b2deb55f9ea1f..5ea908696a0e0d 100644 --- a/packages/admin-manifest/src/index.js +++ b/packages/admin-manifest/src/index.js @@ -1,7 +1,9 @@ function addManifest( manifest ) { const link = document.createElement( 'link' ); link.rel = 'manifest'; - link.href = 'data:application/manifest+json,' + JSON.stringify( manifest ); + link.href = `data:application/manifest+json,${ encodeURIComponent( + JSON.stringify( manifest ) + ) }`; document.head.appendChild( link ); } @@ -94,8 +96,7 @@ window.addEventListener( 'load', () => { const { logo, siteTitle, adminUrl } = window.wpAdminManifestL10n; const manifest = { - // Replace spaces with non breaking spaces. Chrome collapses them. - name: siteTitle.replace( / /g, ' ' ), + name: siteTitle, display: 'standalone', orientation: 'portrait', start_url: adminUrl,