mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
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).
This commit is contained in:
committed by
Sarah Boyce
parent
23c960a98e
commit
29ba75e6e5
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user