Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #18071 -- Ignored case sensitivity in urlize utility. Thanks lu…

…ke@creaturecreative.com and adamzap for the report and the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17898 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e2548ec2a9e2f8dc733bcc72681fd28a34af4dbd 1 parent f069757
Claude Paroz authored April 11, 2012
4  django/utils/html.py
@@ -20,8 +20,8 @@
20 20
 unencoded_ampersands_re = re.compile(r'&(?!(\w+|#\d+);)')
21 21
 unquoted_percents_re = re.compile(r'%(?![0-9A-Fa-f]{2})')
22 22
 word_split_re = re.compile(r'(\s+)')
23  
-simple_url_re = re.compile(r'^https?://\w')
24  
-simple_url_2_re = re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)$')
  23
+simple_url_re = re.compile(r'^https?://\w', re.IGNORECASE)
  24
+simple_url_2_re = re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)$', re.IGNORECASE)
25 25
 simple_email_re = re.compile(r'^\S+@\S+\.\S+$')
26 26
 link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+')
27 27
 html_gunk_re = re.compile(r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE)
4  tests/regressiontests/defaultfilters/tests.py
@@ -292,6 +292,10 @@ def test_urlize(self):
292 292
         self.assertEqual(urlize('email@.stream.ru'),
293 293
             u'email@.stream.ru')
294 294
 
  295
+        # Check urlize accepts uppercased URL schemes - see #18071
  296
+        self.assertEqual(urlize('HTTPS://github.com/'),
  297
+            u'<a href="https://github.com/" rel="nofollow">HTTPS://github.com/</a>')
  298
+
295 299
     def test_wordcount(self):
296 300
         self.assertEqual(wordcount(''), 0)
297 301
         self.assertEqual(wordcount(u'oneword'), 1)

0 notes on commit e2548ec

Please sign in to comment.
Something went wrong with that request. Please try again.