Skip to content

Commit

Permalink
Add sanitization
Browse files Browse the repository at this point in the history
  • Loading branch information
ytkimirti committed Sep 18, 2023
1 parent 3edabe1 commit 9573665
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@
// Skip it on the first load since it's already saved
void saveNote();

// Sanitize html
text = text
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");

// Turn urls into links
const urlRegex = /(https?:\/\/[^\s]+)/g;
text = text.replace(
Expand Down

0 comments on commit 9573665

Please sign in to comment.