Opened 9 years ago

Closed 9 years ago

#23715 closed Bug (fixed)

Template tag urlize and exclamation mark

Reported by: Steven Owned by: Markus Holtermann
Component: Template system Version: 1.7
Severity: Normal Keywords:
Cc: info+coding@… 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 (last modified by Steven)

The template tag urlize cannot create the urls correctly when an exclamation mark follows an url.

text = "Check out www.djangoproject.com!"
text|urlize

results in:

"Check out <a href="(...)!">www.djangoproject.com!</a>"

Change History (10)

comment:1 by Steven, 9 years ago

Description: modified (diff)

comment:2 by Aymeric Augustin, 9 years ago

Yes, but we should also consider the case where the ! is part of the URL. Random, made-up example: www.unicode-lookup.info/q=!

comment:3 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Markus Holtermann, 9 years ago

What about Go to google.com/?q=django!? is the query django or django!?

comment:5 by Markus Holtermann, 9 years ago

Cc: info+coding@… added

comment:6 by Aymeric Augustin, 9 years ago

Mail.app has sophisticated URL detection rules, and here's how it handles the examples we've given above:

in reply to:  6 comment:7 by Markus Holtermann, 9 years ago

Has patch: set
Owner: changed from nobody to Markus Holtermann
Status: newassigned

comment:8 by Aymeric Augustin, 9 years ago

The patch looks good to me (assuming the CI passes).

comment:9 by Aymeric Augustin, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In ed2f96819c9ad6e21e4d397b6418915f5caf522f:

Fixed #23715 -- Prevented urlize from treating a trailing ! as part of an URL

Thanks to 57even for the report.

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