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