Fixed #36710 -- Fixed a regression in urlize for multipart domain names.
Some checks are pending
Docs / spelling (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Docs / lint-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.14 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run

Thanks Mehraz Hossain Rumman for the report and Bruno Alla for the triage.

Regression in a9fe98d5bd.
This commit is contained in:
Mehraz Hossain Rumman 2025-11-06 04:05:54 +06:00 committed by GitHub
parent dfcc662cf8
commit 125b63ca74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View file

@ -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,
)

View file

@ -455,6 +455,10 @@ class TestUtilsHtml(SimpleTestCase):
'<a href="mailto:idna-2008@%DE%89%DE%A8%DE%80%DE%A7%DE%83%DE%AA.ex'
'ample.mv">idna-2008@މިހާރު.example.mv</a>',
),
(
"host.djangoproject.com",
'<a href="https://host.djangoproject.com">host.djangoproject.com</a>',
),
)
for value, output in tests:
with self.subTest(value=value):