From 125b63ca745bace1e098ed3c7362d59136f68a8b Mon Sep 17 00:00:00 2001
From: Mehraz Hossain Rumman <59512321+MehrazRumman@users.noreply.github.com>
Date: Thu, 6 Nov 2025 04:05:54 +0600
Subject: [PATCH] Fixed #36710 -- Fixed a regression in urlize for multipart
domain names.
Thanks Mehraz Hossain Rumman for the report and Bruno Alla for the triage.
Regression in a9fe98d5bd4212d069afe8316101984aadecfbb2.
---
django/utils/html.py | 1 +
tests/utils_tests/test_html.py | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/django/utils/html.py b/django/utils/html.py
index 734d7fbfb3..b04d6bc5ee 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -297,6 +297,7 @@ class Urlizer:
simple_url_re = _lazy_re_compile(r"^https?://\[?\w", re.IGNORECASE)
simple_url_2_re = _lazy_re_compile(
rf"^www\.|^(?!http)(?:{DomainNameValidator.hostname_re})"
+ rf"(?:{DomainNameValidator.domain_re})"
r"\.(com|edu|gov|int|mil|net|org)($|/.*)$",
re.IGNORECASE,
)
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index bf00d14496..b388d3ce52 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -455,6 +455,10 @@ class TestUtilsHtml(SimpleTestCase):
'idna-2008@މިހާރު.example.mv',
),
+ (
+ "host.djangoproject.com",
+ 'host.djangoproject.com',
+ ),
)
for value, output in tests:
with self.subTest(value=value):