Opened 8 years ago

Closed 8 years ago

#26193 closed Bug (fixed)

urlize doesn't handle extra punctuation after the link properly

Reported by: Lee Semel Owned by: nobody
Component: Utilities Version: 1.8
Severity: Normal Keywords:
Cc: jon.dufresne@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the code below, the first call to urlize() works as expected, excluding the period from the url. I'd have expected the other examples to also exclude the punctuation from the link, but it always pulls in all of the punctuation save for the last character.

>>> from django.utils.html import urlize
>>> urlize('This is a test http://testing.com/example.')
u'This is a test <a href="http://testing.com/example">http://testing.com/example</a>.'
>>> urlize('This is a test http://testing.com/example..')
u'This is a test <a href="http://testing.com/example.">http://testing.com/example.</a>.'
>>> urlize('This is a test http://testing.com/example!!')
u'This is a test <a href="http://testing.com/example!">http://testing.com/example!</a>!'
>>> urlize('This is a test http://testing.com/example!!!')
u'This is a test <a href="http://testing.com/example!!">http://testing.com/example!!</a>!'

Change History (4)

comment:1 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Jon Dufresne, 8 years ago

Cc: jon.dufresne@… added
Has patch: set

comment:3 by Tim Graham, 8 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In dec334c:

Fixed #26193 -- Made urlize() trim multiple trailing punctuation.

Note: See TracTickets for help on using tickets.
Back to Top