mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Simplify requote_path.
It no longer needs to split on '/' since '/' will not be encoded.
This commit is contained in:
+1
-3
@@ -425,10 +425,8 @@ def requote_path(path):
|
||||
This function passes the given path through an unquote/quote cycle to
|
||||
ensure that it is fully and consistently quoted.
|
||||
"""
|
||||
parts = path.split("/")
|
||||
# Unquote only the unreserved characters
|
||||
# Then quote only illegal characters (do not quote reserved, unreserved,
|
||||
# or '%')
|
||||
parts = (quote(unquote_unreserved(part), safe="!#$%&'()*+,/:;=?@[]~")
|
||||
for part in parts)
|
||||
return quote(unquote_unreserved(path), safe="!#$%&'()*+,/:;=?@[]~")
|
||||
return "/".join(parts)
|
||||
|
||||
Reference in New Issue
Block a user