From bca22dcdd8322bb3ad9b4fdbfdc27b0fc8e5a603 Mon Sep 17 00:00:00 2001 From: James Smith Date: Sun, 21 Dec 2025 14:23:39 +0000 Subject: [PATCH] Fix escapeAttr function syntax for template compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- intercept.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/intercept.py b/intercept.py index 797c21e..4c4195e 100755 --- a/intercept.py +++ b/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, '>'); + return s; } function isValidMac(mac) {