sitesmith: null-safe esc() in Navbar/Menu/Logo + clear chat button
The prior null-safe esc patch only matched 'const esc =' declarations; Menu/Navbar/Logo use 'function esc(str: string)' syntax and slipped through. Patched those three to coerce non-strings the same way. Added "Clear chat" button in the modal header that appears when there's any message history. Confirms with the user before posting to the new clear_history endpoint, which deletes all messages + the thread row for the current site (usage rows are preserved for billing).
This commit is contained in:
@@ -38,7 +38,8 @@ async function uploadToWhp(file: File): Promise<string | null> {
|
||||
}
|
||||
|
||||
/* ---------- Helper: escape HTML ---------- */
|
||||
function esc(str: string): string {
|
||||
function esc(str: any): string {
|
||||
str = String(str ?? "");
|
||||
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user