A platform for community discussion. Free, open, simple.
FIX: Always use absolute URL to load highlightJS bundles (#39175)
David Taylorfecd0698e6b5
diff --git a/frontend/discourse/app/lib/highlight-syntax.js b/frontend/discourse/app/lib/highlight-syntax.jsindex e0941e80110..c58a7020de8 100644--- a/frontend/discourse/app/lib/highlight-syntax.js+++ b/frontend/discourse/app/lib/highlight-syntax.js@@ -104,7 +104,8 @@ async function loadLanguageInitializer(langFile) {}// Load site-specific language bundle generated by Rails HighlightJsController- const url = getURLWithCDN(langFile);+ // URL constructor used to add hostname to relative URLs+ const url = new URL(getURLWithCDN(langFile), window.location);const module = await import(/* webpackIgnore: true */ url);return module.default;}