Skip to content

Commit 84073e2

Browse files
Fix code scanning alert no. 4: DOM text reinterpreted as HTML
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 4e197e9 commit 84073e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib/global.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ document.addEventListener("astro:page-load", () => {
8989
document.addEventListener("astro:page-load", () => {
9090
const Key = localStorage.getItem("key") || "";
9191
const PanicKeys = Key.split(",").map((key) => key.trim());
92-
const PanicLink = localStorage.getItem("link") || "";
92+
let PanicLink = localStorage.getItem("link") || "";
93+
try {
94+
PanicLink = new URL(PanicLink).toString();
95+
} catch (e) {
96+
PanicLink = "";
97+
}
9398
let Typed: string[] = [];
9499
let Shift = false;
95100

0 commit comments

Comments
 (0)