summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-01-07 18:15:28 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-01-07 18:15:28 +0000
commite3a7bfccbb83712caf0645e4e33f5c03d9dc462b (patch)
tree586ed337ed7ead1568522a96bea303afa9845b32 /tests
parentc3697a091b7ff0d19f13821b18516ec8eaa1b8f8 (diff)
Fixed #9655 -- Prevented the urlize template filter from double-quoting URLs. Thanks Claude Paroz for writing the tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17347 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/defaultfilters/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py
index 5e8c8f1538..00518344a3 100644
--- a/tests/regressiontests/defaultfilters/tests.py
+++ b/tests/regressiontests/defaultfilters/tests.py
@@ -238,6 +238,19 @@ class DefaultFiltersTests(TestCase):
# Check urlize with https addresses
self.assertEqual(urlize('https://google.com'),
u'<a href="https://google.com" rel="nofollow">https://google.com</a>')
+ # Check urlize doesn't overquote already quoted urls - see #9655
+ self.assertEqual(urlize('http://hi.baidu.com/%D6%D8%D0%C2%BF'),
+ u'<a href="http://hi.baidu.com/%D6%D8%D0%C2%BF" rel="nofollow">'
+ u'http://hi.baidu.com/%D6%D8%D0%C2%BF</a>')
+ self.assertEqual(urlize('www.mystore.com/30%OffCoupons!'),
+ u'<a href="http://www.mystore.com/30%25OffCoupons!" rel="nofollow">'
+ u'www.mystore.com/30%OffCoupons!</a>')
+ self.assertEqual(urlize('http://en.wikipedia.org/wiki/Caf%C3%A9'),
+ u'<a href="http://en.wikipedia.org/wiki/Caf%C3%A9" rel="nofollow">'
+ u'http://en.wikipedia.org/wiki/Caf%C3%A9</a>')
+ self.assertEqual(urlize('http://en.wikipedia.org/wiki/Café'),
+ u'<a href="http://en.wikipedia.org/wiki/Caf%C3%A9" rel="nofollow">'
+ u'http://en.wikipedia.org/wiki/Café</a>')
def test_wordcount(self):
self.assertEqual(wordcount(''), 0)