mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 02:55:17 +00:00
[utils] Always decode Location header
escape_url is broken for bytes-like objects
This commit is contained in:
parent
4a684895c0
commit
0ea590076f
1 changed files with 2 additions and 0 deletions
|
@ -861,6 +861,8 @@ def http_response(self, req, resp):
|
|||
# As of RFC 2616 default charset is iso-8859-1 that is respected by python 3
|
||||
if sys.version_info >= (3, 0):
|
||||
location = location.encode('iso-8859-1').decode('utf-8')
|
||||
else:
|
||||
location = location.decode('utf-8')
|
||||
location_escaped = escape_url(location)
|
||||
if location != location_escaped:
|
||||
del resp.headers['Location']
|
||||
|
|
Loading…
Reference in a new issue