Fixed #35533 -- Prevented urlize creating broken links given a markdown link input.
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.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run

Signed-off-by: SaJH <wogur981208@gmail.com>
This commit is contained in:
SaJH 2025-08-27 23:25:43 +09:00 committed by Sarah Boyce
parent 05bac8c420
commit a9fe98d5bd
3 changed files with 7 additions and 5 deletions

View file

@ -359,9 +359,8 @@ class FunctionTests(SimpleTestCase):
"www.example.com</a>]",
)
self.assertEqual(
urlize("see test[at[example.com"),
'see <a href="https://test[at[example.com" rel="nofollow">'
"test[at[example.com</a>",
urlize("see test[at[example.com"), # Invalid hostname.
"see test[at[example.com",
)
self.assertEqual(
urlize("[http://168.192.0.1](http://168.192.0.1)"),

View file

@ -489,6 +489,7 @@ class TestUtilsHtml(SimpleTestCase):
"foo@localhost.",
"test@example?;+!.com",
"email me@example.com,then I'll respond",
"[a link](https://www.djangoproject.com/)",
# trim_punctuation catastrophic tests
"(" * 100_000 + ":" + ")" * 100_000,
"(" * 100_000 + "&:" + ")" * 100_000,