#26005: uri_to_iri() broken
-------------------------------+--------------------
Reporter: Chronial | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (URLs) | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
The current implementation of uri_to_iri is incorrect.
In step two of [http://tools.ietf.org/html/rfc3987.html#section-3.2 the
algorithm], it should:
> Convert all percent-encodings ("%" followed by two hexadecimal
digits) to the corresponding octets, except those corresponding to
"%", characters in "reserved", and characters in US-ASCII not
allowed in URIs.
But instead it just runs an unquote
([https://github.com/django/django/blob/dbb0df2a0ec5bee80bee336fc81408efb30b7e47/django/utils/encoding.py#L199
source])
This also makes this statement from
[https://docs.djangoproject.com/en/1.9/ref/unicode/#uri-and-iri-handling
the docs] a lie:
> Both iri_to_uri() and uri_to_iri() functions are idempotent, which means
the following is always true:
> uri_to_iri(uri_to_iri(some_string)) == uri_to_iri(some_string)
But at the moment
{{{
uri_to_iri(uri_to_iri("%2525")) == "%" != "%25" == uri_to_iri("%2525")
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26005>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.8ddd913f5ae050708163e993d4d4194b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.