#30043: AdminURLFieldWidget incorrectly unquotes URLs e.g. containing %2F
-------------------------------------+-------------------------------------
Reporter: Brenton Partridge | Owner: Brady
Type: Bug | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin, urlfield, | Triage Stage: Accepted
smart_urlquote, url, quote |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Brady):
Hey Carlton,
So I got close to thinking this was intractable essentially due to not
being able to identify if the string had already been encoded or not.
Specifically around the path that had been specified (I think this is
where the original ticket came from, because during testing the %2F only
became a problem when it was part of the path. Identified by the use case
you showed above `smart_urlquote('%2F')` ) - Although I would think this
is expected behavior in the sense that if you have %2F in the path, I
would think you'd want that converted to a `/` anyways.
I tried a few ways of handling this case without a special case, and could
not come up with a viable solution, but once I added a check to see if the
segment already contained `%2F` was I able to pass the tests. To be honest
though, the more I think about it, the more I might have been coding to
pass the tests as opposed to actually solving the problem. (I'm not
actually sure what the real problem is, because the ticket author didn't
provide a use case)
I can continue to write some more tests, and try to figure out a way to
make this less of a special case, but would love to hear both your
thoughts on how much of a problem this actually is.
--
Ticket URL: <https://code.djangoproject.com/ticket/30043#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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.264b9651c2183facd19ec581f3ebd9d0%40djangoproject.com.