mirror of
https://github.com/smittix/intercept.git
synced 2026-07-13 20:18:10 -07:00
Fix escapeAttr function syntax for template compatibility
Rewrote escapeAttr to use simple replace chains instead of arrow function with object lookup, which was causing JavaScript parsing issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+7
-4
@@ -2617,10 +2617,13 @@ HTML_TEMPLATE = '''
|
|||||||
function escapeAttr(text) {
|
function escapeAttr(text) {
|
||||||
// Escape for use in HTML attributes (especially onclick handlers)
|
// Escape for use in HTML attributes (especially onclick handlers)
|
||||||
if (text === null || text === undefined) return '';
|
if (text === null || text === undefined) return '';
|
||||||
return String(text).replace(/[&'"<>\\]/g, c => ({
|
var s = String(text);
|
||||||
'&': '&', "'": ''', '"': '"',
|
s = s.replace(/&/g, '&');
|
||||||
'<': '<', '>': '>', '\\': '\\\\'
|
s = s.replace(/'/g, ''');
|
||||||
})[c]);
|
s = s.replace(/"/g, '"');
|
||||||
|
s = s.replace(/</g, '<');
|
||||||
|
s = s.replace(/>/g, '>');
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isValidMac(mac) {
|
function isValidMac(mac) {
|
||||||
|
|||||||
Reference in New Issue
Block a user