File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 41
41
tv tw tz ua ug uk us uy uz va vc ve vg vi vn vu wf ws xn ye yt yu za zm
42
42
zw""" .split ()
43
43
44
+ TLDS .reverse ()
44
45
45
- url_re = re .compile (r'\b(?:[\w-]+:/{0,3})?(?<!@)[\w.-]+\.(?:(?:%s)\w*)(?:(?:\/|\?)\S*)?' % u'|' .join (TLDS ))
46
+
47
+ url_re = re .compile (r'\b(?:[\w-]+:/{0,3})?(?<!@)[\w.-]+\.(?:%s)(?:[/?]\S*)?\b' % u'|' .join (TLDS ))
46
48
proto_re = re .compile (r'^[\w-]+:/{0,3}' )
47
49
48
50
Original file line number Diff line number Diff line change @@ -110,3 +110,15 @@ def test_escaped_html():
110
110
#def test_link_http_complete():
111
111
# eq_('<a href="https://user:pass@ftp.mozilla.com/x/y.exe?a=b&c=d&e#f">https://user:pass@ftp.mozilla.com/x/y.exe?a=b&c=d&e#f</a>',
112
112
# b.linkify('https://user:pass@ftp.mozilla.org/x/y.exe?a=b&c=d&e#f'))
113
+
114
+
115
+ def test_non_url ():
116
+ """document.vulnerable should absolutely not be linkified."""
117
+ s = 'document.vulnerable'
118
+ eq_ (s , b .linkify (s ))
119
+
120
+
121
+ def test_javascript_url ():
122
+ """javascript: urls should never be linkified."""
123
+ s = 'javascript:document.vulnerable'
124
+ eq_ (s , b .linkify (s ))
Original file line number Diff line number Diff line change 2
2
3
3
setup (
4
4
name = 'bleach' ,
5
- version = '0.3.1 ' ,
5
+ version = '0.3.2 ' ,
6
6
description = 'An easy whitelist-based HTML-sanitizing tool.' ,
7
7
long_description = open ('README.rst' ).read (),
8
8
author = 'James Socol' ,
You can’t perform that action at this time.
0 commit comments