From ceca34aca6cc34113446eaabb2bcf91415f29aad Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 2 Dec 2021 10:58:54 +0000 Subject: [PATCH] DEV: Ensure ember-cli does not attempt to bootstrap non-ember pages (#15168) 1b3d124a introduced a logic change which meant that we attempted to bootstrap, even on pages without any `preloadJson` (i.e. non-ember HTML pages from Discourse). This commit restores the original logic, making sure to avoid `?.`. --- app/assets/javascripts/discourse/lib/bootstrap-json/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/lib/bootstrap-json/index.js b/app/assets/javascripts/discourse/lib/bootstrap-json/index.js index 6cea5eeb848..bf3b1cc7c47 100644 --- a/app/assets/javascripts/discourse/lib/bootstrap-json/index.js +++ b/app/assets/javascripts/discourse/lib/bootstrap-json/index.js @@ -270,9 +270,11 @@ async function handleRequest(proxy, baseURL, req, res) { } const contentType = response.headers.get("content-type"); + const isHTML = contentType && contentType.startsWith("text/html"); const responseText = await response.text(); + const preloadJson = isHTML ? extractPreloadJson(responseText) : null; - if (contentType && contentType.startsWith("text/html")) { + if (preloadJson) { const html = await buildFromBootstrap( proxy, baseURL,