Skip to content

Commit 42f6a16

Browse files
committed
impr(modes-notice): escape custom text name for safe HTML rendering
!nuf
1 parent 9e5e483 commit 42f6a16

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

frontend/src/ts/elements/modes-notice.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as CustomTextState from "../states/custom-text-name";
1010
import { getLanguageDisplayString } from "../utils/strings";
1111
import Format from "../utils/format";
1212
import { getActiveFunboxNames } from "../test/funbox/list";
13+
import { escapeHTML } from "../utils/misc";
1314

1415
ConfigEvent.subscribe((eventKey) => {
1516
const configKeys: ConfigEvent.ConfigEventKey[] = [
@@ -79,7 +80,9 @@ export async function update(): Promise<void> {
7980
const isLong = CustomTextState.isCustomTextLong();
8081
if (Config.mode === "custom" && customTextName !== "" && isLong) {
8182
$(".pageTest #testModesNotice").append(
82-
`<div class="textButton noInteraction"><i class="fas fa-book"></i>${customTextName} (shift + enter to save progress)</div>`
83+
`<div class="textButton noInteraction"><i class="fas fa-book"></i>${escapeHTML(
84+
customTextName
85+
)} (shift + enter to save progress)</div>`
8386
);
8487
}
8588

0 commit comments

Comments
 (0)