summaryrefslogtreecommitdiff
path: root/tests/admin_widgets
diff options
context:
space:
mode:
authorMike Edmunds <medmunds@gmail.com>2024-12-14 16:54:42 -0800
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-23 10:38:15 +0100
commit29ba75e6e57414f0e6f9528d08a520b8b931fb28 (patch)
tree59757ea3ef4cb0cffa14ee1a499209c83e982110 /tests/admin_widgets
parent23c960a98e0d054d51dadda7049a54a083ef1155 (diff)
Fixed #36013 -- Removed use of IDNA-2003 in django.utils.html.
Removed obsolete and potentially problematic IDNA 2003 ("punycode") encoding of international domain names in smart_urlquote() and Urlizer, which are used (only) by AdminURLFieldWidget and the urlize/urlizetrunc template filters. Changed to use percent-encoded UTF-8, which defers IDNA details to the browser (like other URLs rendered by Django).
Diffstat (limited to 'tests/admin_widgets')
-rw-r--r--tests/admin_widgets/tests.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
index fb296c8655..efff4e47d7 100644
--- a/tests/admin_widgets/tests.py
+++ b/tests/admin_widgets/tests.py
@@ -486,11 +486,13 @@ class AdminURLWidgetTest(SimpleTestCase):
w = widgets.AdminURLFieldWidget()
self.assertHTMLEqual(
w.render("test", "http://example-äüö.com"),
- '<p class="url">Currently: <a href="http://xn--example--7za4pnc.com">'
+ '<p class="url">Currently: <a href="http://example-%C3%A4%C3%BC%C3%B6.com">'
"http://example-äüö.com</a><br>"
'Change:<input class="vURLField" name="test" type="url" '
'value="http://example-äüö.com"></p>',
)
+ # Does not use obsolete IDNA-2003 encoding (#36013).
+ self.assertNotIn("fass.example.com", w.render("test", "http://faß.example.com"))
def test_render_quoting(self):
"""
@@ -517,7 +519,8 @@ class AdminURLWidgetTest(SimpleTestCase):
output = w.render("test", "http://example-äüö.com/<sometag>some-text</sometag>")
self.assertEqual(
HREF_RE.search(output)[1],
- "http://xn--example--7za4pnc.com/%3Csometag%3Esome-text%3C/sometag%3E",
+ "http://example-%C3%A4%C3%BC%C3%B6.com/"
+ "%3Csometag%3Esome-text%3C/sometag%3E",
)
self.assertEqual(
TEXT_RE.search(output)[1],