Opened 8 years ago

Closed 8 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 Changed 8 years ago by Steven

Description: modified (diff)

comment:2 Changed 8 years ago by Aymeric Augustin

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 Changed 8 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:4 Changed 8 years ago by Markus Holtermann

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

comment:5 Changed 8 years ago by Markus Holtermann

Cc: info+coding@… added

comment:6 Changed 8 years ago by Aymeric Augustin

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

comment:7 in reply to:  6 Changed 8 years ago by Markus Holtermann

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

comment:8 Changed 8 years ago by Aymeric Augustin

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

comment:9 Changed 8 years ago by Aymeric Augustin

Triage Stage: AcceptedReady for checkin

comment:10 Changed 8 years ago by Tim Graham <timograham@…>

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