summaryrefslogtreecommitdiff
path: root/tests/admin_widgets
diff options
context:
space:
mode:
authorMike Edmunds <medmunds@gmail.com>2024-12-15 01:54:42 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-23 10:40:58 +0100
commit698d05c11c27d4ed5fd75194ac0edcf133bd7600 (patch)
tree32887587eba7b1c86f15af0bf50f64d3d39d4683 /tests/admin_widgets
parentd6c2b6788405d0370b29a7ee9aa81ee8ead6a25b (diff)
[5.2.x] 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). Backport of 29ba75e6e57414f0e6f9528d08a520b8b931fb28 from main.
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 0cf1324623..74fc30a706 100644
--- a/tests/admin_widgets/tests.py
+++ b/tests/admin_widgets/tests.py
@@ -490,11 +490,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):
"""
@@ -521,7 +523,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],