mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -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:
11
intercept.py
11
intercept.py
@@ -2617,10 +2617,13 @@ HTML_TEMPLATE = '''
|
||||
function escapeAttr(text) {
|
||||
// Escape for use in HTML attributes (especially onclick handlers)
|
||||
if (text === null || text === undefined) return '';
|
||||
return String(text).replace(/[&'"<>\\]/g, c => ({
|
||||
'&': '&', "'": ''', '"': '"',
|
||||
'<': '<', '>': '>', '\\': '\\\\'
|
||||
})[c]);
|
||||
var s = String(text);
|
||||
s = s.replace(/&/g, '&');
|
||||
s = s.replace(/'/g, ''');
|
||||
s = s.replace(/"/g, '"');
|
||||
s = s.replace(/</g, '<');
|
||||
s = s.replace(/>/g, '>');
|
||||
return s;
|
||||
}
|
||||
|
||||
function isValidMac(mac) {
|
||||
|
||||
Reference in New Issue
Block a user