summary refs log tree commit diff
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-05-26 17:22:40 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-06-02 15:00:49 +0800
commit0ea590076fd3b714b6a3345a28ac61d8be5e2afd (patch)
treeb8a530f8ea8bfb1970cea387d817e0593cd400b0
parent4a684895c0227bf18896eae36e693d7046aacaf4 (diff)
downloadyoutube-dl-0ea590076fd3b714b6a3345a28ac61d8be5e2afd.tar.gz
youtube-dl-0ea590076fd3b714b6a3345a28ac61d8be5e2afd.tar.xz
youtube-dl-0ea590076fd3b714b6a3345a28ac61d8be5e2afd.zip
[utils] Always decode Location header
escape_url is broken for bytes-like objects
-rw-r--r--youtube_dl/utils.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index cfb2d1bf5..6ab1747b3 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -861,6 +861,8 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):
                 # 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']