mirror of
https://github.com/apophenia-news/apophenia.news.git
synced 2026-06-07 23:12:13 +00:00
Fix: Handle non-string values in escape utilities
Co-authored-by: gemini-3.5-flash <gemini@google.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user