From 4ba2662db289acfe9d2d62dd0a6c83ad6c104564 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Sun, 31 May 2026 13:32:43 -0700 Subject: [PATCH] Fix: Handle non-string values in escape utilities Co-authored-by: gemini-3.5-flash --- scripts/lib/utils.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/utils.mjs b/scripts/lib/utils.mjs index f6a2769..ff494db 100644 --- a/scripts/lib/utils.mjs +++ b/scripts/lib/utils.mjs @@ -4,10 +4,10 @@ export const fmtDate = (date) => export const toISODate = (d) => new Date(d).toISOString().split("T")[0]; export const escapeHtml = (s = "") => - s.replace(/[&<>"']/g, (ch) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[ch])); + String(s ?? "").replace(/[&<>"']/g, (ch) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[ch])); export const escapeXml = (s = "") => - s.replace(/[<>&'"]/g, (ch) => ({ "<": "<", ">": ">", "&": "&", "'": "'", '"': """ }[ch])); + String(s ?? "").replace(/[<>&'"]/g, (ch) => ({ "<": "<", ">": ">", "&": "&", "'": "'", '"': " "" }[ch])); export const fixInternalLinks = (html) => html