Skip to content

Commit

Permalink
Update pinback.js
Browse files Browse the repository at this point in the history
Make sure that `escapeHtml` does not bomb on non-string values. Fixes pinbackit#16
  • Loading branch information
ArtBIT authored Jan 30, 2024
1 parent ffbf1e6 commit 2266e1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pinback.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@

// simple escape html
function escapeHtml(unsafe) {
return unsafe.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
return unsafe?.replace?.(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;") || "";
}

// generate Netscape bookmark file
Expand Down

0 comments on commit 2266e1b

Please sign in to comment.