diff --git a/django/utils/html.py b/django/utils/html.py index 7e35fdecb8..ca3340ccb1 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -17,7 +17,7 @@ from django.utils import six from django.utils.text import normalize_newlines # Configuration for urlize() function. -TRAILING_PUNCTUATION = ['.', ',', ':', ';'] +TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)'] WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('<', '>')] # List of possible strings used for bullets in bulleted lists. diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py index e2907632ef..2852572d32 100644 --- a/tests/regressiontests/defaultfilters/tests.py +++ b/tests/regressiontests/defaultfilters/tests.py @@ -298,6 +298,10 @@ class DefaultFiltersTests(TestCase): self.assertEqual(urlize('HTTPS://github.com/'), 'HTTPS://github.com/') + # Check urlize trims trailing period when followed by parenthesis - see #18644 + self.assertEqual(urlize('(Go to http://www.example.com/foo.)'), + '(Go to http://www.example.com/foo.)') + def test_wordcount(self): self.assertEqual(wordcount(''), 0) self.assertEqual(wordcount('oneword'), 1)