#28679: urlencode does not decode bytes before passing them to Python's
urlencode
-------------------------------------+-------------------------------------
Reporter: François Freitag | Owner: François
| Freitag
Type: Bug | Status: assigned
Component: Utilities | Version: 2.0
Severity: Release blocker | Resolution:
Keywords: urlencode bytes | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by François Freitag):
My use case is a
[https://github.com/knaperek/djangosaml2/blob/b39eba56b7a0d89ad0b4f261c45f4d579143f64a/djangosaml2/tests/__init__.py#L391-L396|
library passing zipped xml, base64 encoded] over GET parameters. The
output of {{{base64.b64encode}}} is bytes, and I think Django should not
change that (even though it does not matter in my use case).
I updated the PR to simply pass bytes "as is" to Python's {{{urlencode}}}.
I agree that calling {{{force_text}}} on the value is not the best option.
Is this the only motivation or is there a use case?
I do not have a use case for Django not decoding bytes, but I find it
safer than decoding a content that does not need it. I prefer Django being
consistent with Python. The added value of Django's {{{urlencode}}} is the
understanding of QueryDict, I do not expect it to re-encode the bytes I've
given.
--
Ticket URL: <https://code.djangoproject.com/ticket/28679#comment:8>
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/073.40909b176c7c0e86a61d230d7c1330c8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.