Skip to content

Commit

Permalink
handle undefined param in escapeHtml (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakprabhakara authored Mar 5, 2024
1 parent 084596d commit 13a51a5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/post.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const escapeHtml = (unsafeHtml: string) => {
return unsafeHtml
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
? unsafeHtml
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;')
: unsafeHtml;
};

const createPostForm = (postUrl: string, params: { name: string; value: string }[]) => {
Expand Down

0 comments on commit 13a51a5

Please sign in to comment.