MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / sanitizeMessageHTML

Function sanitizeMessageHTML

source code/services/api/errorUtils.ts:109–118  ·  view source on GitHub ↗

* Strips HTML content (e.g., CloudFlare error pages) from a message string, * returning a user-friendly title or empty string if HTML is detected. * Returns the original message unchanged if no HTML is found.

(message: string)

Source from the content-addressed store, hash-verified

107 * Returns the original message unchanged if no HTML is found.
108 */
109function sanitizeMessageHTML(message: string): string {
110 if (message.includes('<!DOCTYPE html') || message.includes('<html')) {
111 const titleMatch = message.match(/<title>([^<]+)<\/title>/)
112 if (titleMatch && titleMatch[1]) {
113 return titleMatch[1].trim()
114 }
115 return ''
116 }
117 return message
118}
119
120/**
121 * Detects if an error message contains HTML content (e.g., CloudFlare error pages)

Callers 2

sanitizeAPIErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected