From c8f972d01a990bc503ef1caac25be1f078c5e588 Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Fri, 20 Nov 2026 20:26:30 -0300 Subject: [PATCH] fix(templates): pass names to hyperscript through data attributes Django's ' escaping is decoded by the browser before hyperscript parses a _="..." attribute, so a quote in a currency or account name closed the string and the rest ran as hyperscript. Names now live in plain data-* attributes and are read with @data-*. Spaces in currency prefixes and suffixes are kept. Refs GHSA-fh52-f8r4-hv6g --- app/apps/net_worth/tests.py | 8 +++++++- .../accounts/fragments/account_reconciliation.html | 6 ++++-- app/templates/net_worth/net_worth.html | 12 ++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/apps/net_worth/tests.py b/app/apps/net_worth/tests.py index e35042be..55c1feae 100644 --- a/app/apps/net_worth/tests.py +++ b/app/apps/net_worth/tests.py @@ -1,3 +1,4 @@ +import re import tempfile from datetime import date from decimal import Decimal @@ -71,7 +72,7 @@ class NetWorthCurrencyChartTests(TestCase): self.assertEqual(consolidated["pointHitRadius"], 8) self.assertContains( response, - "showOnlyCurrencyDataset('US Dollar Consolidated', 'US Dollar')", + 'data-dataset="US Dollar Consolidated" data-difference="US Dollar"', html=False, ) self.assertContains( @@ -156,3 +157,8 @@ class NetWorthChartEscapingTests(TestCase): self.assertEqual(response.status_code, 200) self.assertNotContains(response, "