[Django] #30589: urlize parses email addresses with apostrophes incorrectly

10 views
Skip to first unread message

Django

unread,
Jun 24, 2019, 7:32:17 PM6/24/19
to django-...@googlegroups.com
#30589: urlize parses email addresses with apostrophes incorrectly
-------------------------------------------+------------------------
Reporter: Mark Gregson | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
In 1.11.21 I've observed that the urlize template tag messes up email
addresses containing apostrophes in the local part, specifically, it
excludes any characters before the apostrophe from the link text and href
attribute.

A simple example using django.utils.htmls.urlize:
{{{
>>> from django.utils.html import urlize
>>> urlize("o'ne...@example.com")
u'o\'<a href="mailto:ne...@example.com">ne...@example.com</a>'
}}}
I would expect this to return:
{{{
u'<a href="mailto:o\'ne...@example.com">o\'ne...@example.com</a>'
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30589>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 24, 2019, 9:55:56 PM6/24/19
to django-...@googlegroups.com
#30589: urlize parses email addresses with apostrophes incorrectly
---------------------------------+--------------------------------------

Reporter: Mark Gregson | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Mark Gregson):

Given the range of characters allowed in the local part of an email
address is quite extensive and that a quoted local part is also allowed
(RFC 3696 has a nice summary
https://tools.ietf.org/html/rfc3696#section-3), I realise that there
probably need to be some constraints on what range of email addresses
`urlize` can parse. Potentially then this issue should be resolved by
additional documentation clarifying those constraints.

--
Ticket URL: <https://code.djangoproject.com/ticket/30589#comment:1>

Django

unread,
Jun 25, 2019, 1:37:46 AM6/25/19
to django-...@googlegroups.com
#30589: urlize parses email addresses with apostrophes incorrectly.
--------------------------------------+------------------------------------

Reporter: Mark Gregson | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* cc: Shai Berger (added)
* component: Template system => Documentation
* version: 1.11 => master
* easy: 0 => 1
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

Thanks for the report. We excluded quotes in the #24471. It seems that
only single quotes from the list of allowed special characters are
affected. I agree that we can clarify this in the documentation, e.g.
{{{Email addresses cannot contain the single quotes (``'``).}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30589#comment:2>

Django

unread,
Jun 28, 2019, 9:01:29 PM6/28/19
to django-...@googlegroups.com
#30589: urlize parses email addresses with apostrophes incorrectly.
-------------------------------------+-------------------------------------
Reporter: Mark Gregson | Owner:
Type: | aitoehigie
Cleanup/optimization | Status: assigned

Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aitoehigie):

* status: new => assigned
* owner: nobody => aitoehigie


Comment:

I will work on this.

--
Ticket URL: <https://code.djangoproject.com/ticket/30589#comment:3>

Django

unread,
Jun 29, 2019, 10:29:26 AM6/29/19
to django-...@googlegroups.com
#30589: urlize parses email addresses with apostrophes incorrectly.
-------------------------------------+-------------------------------------
Reporter: Mark Gregson | Owner:
Type: | aitoehigie
Cleanup/optimization | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* has_patch: 0 => 1


Comment:

PR[https://github.com/django/django/pull/11526]

--
Ticket URL: <https://code.djangoproject.com/ticket/30589#comment:4>

Django

unread,
Jul 1, 2019, 6:04:07 AM7/1/19
to django-...@googlegroups.com
#30589: urlize parses email addresses with apostrophes incorrectly.
--------------------------------------+------------------------------------
Reporter: Mark Gregson | Owner: Pystar
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"c2f381ef17058e5cfea58ae507983d2e459a2888" c2f381e]:
{{{
#!CommitTicketReference repository=""
revision="c2f381ef17058e5cfea58ae507983d2e459a2888"
Fixed #30589 -- Clarified that urlize should be applied only to email
addresses without single quotes.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30589#comment:5>

Django

unread,
Jul 1, 2019, 6:04:44 AM7/1/19
to django-...@googlegroups.com
#30589: urlize parses email addresses with apostrophes incorrectly.
--------------------------------------+------------------------------------
Reporter: Mark Gregson | Owner: Pystar
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"b9d1bb6955d45d9da165ed11292a197d0728fe3f" b9d1bb69]:
{{{
#!CommitTicketReference repository=""
revision="b9d1bb6955d45d9da165ed11292a197d0728fe3f"
[2.2.x] Fixed #30589 -- Clarified that urlize should be applied only to


email addresses without single quotes.

Backport of c2f381ef17058e5cfea58ae507983d2e459a2888 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30589#comment:6>

Reply all
Reply to author
Forward
0 new messages