Skip to content

Commit

Permalink
Assume that _encode_target urls start with slash
Browse files Browse the repository at this point in the history
Indeed, the only _encode_target only calls it if the url starts with a
slash.
  • Loading branch information
pquentin committed Nov 5, 2019
1 parent 97cb1dc commit d1271b1
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/urllib3/util/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,6 @@ def _idna_encode(name):

def _encode_target(target):
"""Percent-encodes a request target so that there are no invalid characters"""
if not target.startswith("/"):
return target

path, query = TARGET_RE.match(target).groups()
target = _encode_invalid_chars(path, PATH_CHARS)
query = _encode_invalid_chars(query, QUERY_CHARS)
Expand Down

0 comments on commit d1271b1

Please sign in to comment.