From 2266e1b875c4b86a92eb86c6a534f8361d9a38c2 Mon Sep 17 00:00:00 2001 From: ArtBIT Date: Tue, 30 Jan 2024 08:07:32 +0100 Subject: [PATCH] Update pinback.js Make sure that `escapeHtml` does not bomb on non-string values. Fixes #16 --- pinback.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pinback.js b/pinback.js index 6d90549..a98b544 100644 --- a/pinback.js +++ b/pinback.js @@ -174,7 +174,7 @@ // simple escape html function escapeHtml(unsafe) { - return unsafe.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); + return unsafe?.replace?.(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'") || ""; } // generate Netscape bookmark file