mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:54:59 +08:00
FIX: Correctly rewrite script/link tags in the proxy (#25204)
Regressed in fe10a3feab
Fixes /theme-qunit
This commit is contained in:
parent
7a8cbf8422
commit
bcb31f79ce
|
@ -44,10 +44,28 @@ function updateScriptReferences({
|
|||
}
|
||||
}
|
||||
|
||||
const newElements = chunks.map(
|
||||
(chunk) =>
|
||||
`<script ${attribute}="${baseURL}${chunk}" data-ember-cli-rewritten="true"></script>`
|
||||
);
|
||||
const newElements = chunks.map((chunk) => {
|
||||
let newElement = `<${element.tagName}`;
|
||||
|
||||
for (const [attr, value] of element.attributes) {
|
||||
if (attr === attribute) {
|
||||
newElement += ` ${attribute}="${baseURL}${chunk}"`;
|
||||
} else if (value === "") {
|
||||
newElement += ` ${attr}`;
|
||||
} else {
|
||||
newElement += ` ${attr}="${value}"`;
|
||||
}
|
||||
}
|
||||
|
||||
newElement += ` data-ember-cli-rewritten="true"`;
|
||||
newElement += `>`;
|
||||
|
||||
if (element.tagName === "script") {
|
||||
newElement += `</script>`;
|
||||
}
|
||||
|
||||
return newElement;
|
||||
});
|
||||
|
||||
if (
|
||||
entrypointName === "discourse" &&
|
||||
|
|
Loading…
Reference in New Issue
Block a user