Skip to content

Commit

Permalink
Fix mozilla#22 and libgl.so.1 linkification.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Socol committed Mar 10, 2011
1 parent c79585a commit d9f2cf6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bleach/__init__.py
Expand Up @@ -54,7 +54,7 @@
TLDS.reverse()

url_re = re.compile(r"""\b(?:[\w-]+:/{0,3})? # http://
(?<!@)([\w-]+\.)+(?:%s)\b # xx.yy.tld
(?<!@)([\w-]+\.)+(?:%s)(?!\.\w)\b # xx.yy.tld
(?:[/?][^\s\{\}\|\\\^\[\]`<>"\x80-\xFF\x00-\x1F\x7F]*)?
# /path/zz (excluding "unsafe" chars from RFC 1738,
# except for # and ~, which happen in practice)
Expand Down
11 changes: 11 additions & 0 deletions bleach/tests/test_links.py
Expand Up @@ -178,3 +178,14 @@ def test_skip_pre():
nofollowed = '<pre><a href="http://xx.com" rel="nofollow">xx</a></pre>'
eq_(nofollowed, linkify(already_linked))
eq_(nofollowed, linkify(already_linked, skip_pre=True))


def test_libgl():
"""libgl.so.1 should not be linkified."""
eq_('libgl.so.1', linkify('libgl.so.1'))


def test_end_of_sentence():
"""example.com. should match."""
eq_('<a href="http://example.com" rel="nofollow">example.com</a>.',
linkify('example.com.'))

0 comments on commit d9f2cf6

Please sign in to comment.