From 698d05c11c27d4ed5fd75194ac0edcf133bd7600 Mon Sep 17 00:00:00 2001 From: Mike Edmunds Date: Sun, 15 Dec 2024 01:54:42 +0100 Subject: [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. --- tests/admin_widgets/tests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests/admin_widgets') 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"), - '

Currently: ' + '

Currently: ' "http://example-äüö.com
" 'Change:

', ) + # 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/some-text") 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], -- cgit v1.3