Opened 12 years ago
Closed 12 years ago
#20363 closed Bug (duplicate)
urlize incorrectly includes quotation marks in links
Reported by: | EmilStenstrom | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | urlize, quotes |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
>>> urlize("some text here \"hi@example.com\" and some text afterwards") u'some text here <a href="mailto:"hi@example.com"">"hi@example.com"</a> and some text afterwards'
Note the extra quotes inside the links.
Luckily, this is solved quite easily, just do this:
>>> from django.utils import html >>> html.TRAILING_PUNCTUATION += ['"', '\''] >>> html.WRAPPING_PUNCTUATION += [('"', '"'), ('\'', '\'')] >>> urlize("some text here \"hi@example.com\" and some text afterwards") u'some text here "<a href="mailto:hi@example.com">hi@example.com</a>" and some text afterwards'
I suggest quotation marks are included in the *_PUNCTUATION variables in django.utils.html.
Note:
See TracTickets
for help on using tickets.
Duplicate of #20364.