Skip to content

Commit 453e278

Browse files
authored
Merge pull request #157 from UseInterstellar/alert-autofix-4
Fix code scanning alert no. 4: DOM text reinterpreted as HTML
2 parents 4e197e9 + 84073e2 commit 453e278

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)