Opened 9 years ago

Closed 9 years ago

#4657 closed (fixed)

urlizetrunc filter appending elipsis to uris of exactly the truncate length

Reported by: SmileyChris Owned by: adrian
Component: Template system Version: master
Severity: Keywords: urlize html utils
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


>>> from django.template.defaultfilters import urlizetrunc
>>> uri = ''
>>> len(uri)
>>> urlizetrunc(uri, 31)
'<a href="" rel="nofollow"></a>'

The attached patch addresses this. Also, if the URI does need truncating, this patch changes it so that the truncation length is - 3 to adjust for the addition of the 3 elipsis characters (see the test in the patch for a better explanation).

Attachments (2)

urlize_trunc.patch (1.5 KB) - added by SmileyChris 9 years ago.
urlize_trunc.2.patch (2.6 KB) - added by SmileyChris 9 years ago.
with tests this time

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by SmileyChris

Changed 9 years ago by SmileyChris

with tests this time

comment:1 Changed 9 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [5513]) Fixed #4657 -- Fixed an error in an edge case of the urlizetrunc filter.
Thanks, SmileyChris.

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