Opened 8 years ago
Last modified 8 years ago
#28796 closed Cleanup/optimization
urlsafe_base64_encode broken on Django 2.0 — at Initial Version
| Reported by: | Nick | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 2.0 |
| Severity: | Normal | Keywords: | |
| Cc: | nathompson7@… | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Suppose we have:
hashed_msg = hmac.new(key, msg=message, digestmod=sha384)
url = urlsafe_base64_encode(hashed.digest())
Now url is a bytes object, say b'asdfwerqwefa'. In django 1.11, bytes-like objects could be placed in urls no problem, creating (say) localhost:8000/asdfwerqwefa
However, in django 2.0, the url becomes (say)
localhost:8000/b'asdfwerqwefa'
which seems less 'urlsafe', as the quotes and the 'b' are added into the url. Shouldn't urlsafe_base64_encode now return a string, if bytes in urls now retain the quotes?