From ecb1aaf60d079306f0c83c00d41bc32c37590ca6 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Mon, 13 Mar 2023 15:11:53 +0100 Subject: [PATCH] Merge pull request #12164 from overleaf/msm-enable-nocdn-editor [web] move `nocdn` checks out of overriden block GitOrigin-RevId: fc9713cc50dccd73ae0582b852ae399e61fe7424 --- services/web/app/views/layout-base.pug | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/services/web/app/views/layout-base.pug b/services/web/app/views/layout-base.pug index 4f8f555c09..475a87c287 100644 --- a/services/web/app/views/layout-base.pug +++ b/services/web/app/views/layout-base.pug @@ -78,12 +78,13 @@ html( block foot-scripts each file in entrypointScripts(entrypoint) script(type="text/javascript", nonce=scriptNonce, src=file) - script(type="text/javascript", nonce=scriptNonce). - //- Look for bundle - var cdnBlocked = typeof Frontend === 'undefined' - //- Prevent loops - var noCdnAlreadyInUrl = window.location.href.indexOf("nocdn=true") != -1 - if (cdnBlocked && !noCdnAlreadyInUrl && navigator.userAgent.indexOf("Googlebot") == -1) { - //- Set query param, server will not set CDN url - window.location.search += "&nocdn=true"; - } + + script(type="text/javascript", nonce=scriptNonce). + //- Look for bundle + var cdnBlocked = typeof Frontend === 'undefined' + //- Prevent loops + var noCdnAlreadyInUrl = window.location.href.indexOf("nocdn=true") != -1 + if (cdnBlocked && !noCdnAlreadyInUrl && navigator.userAgent.indexOf("Googlebot") == -1) { + //- Set query param, server will not set CDN url + window.location.search += "&nocdn=true"; + }