[utils] Fix multipart_encode for Python < 3.5
authorYen Chi Hsuan <yan12125@gmail.com>
Fri, 5 May 2017 12:51:59 +0000 (20:51 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Fri, 5 May 2017 12:51:59 +0000 (20:51 +0800)
youtube_dl/utils.py

index 25bd228ab159d345d878c00191bfc7f05bd5e227..911cacd29ecf26e3f3ed0d48c1265496454a74dc 100644 (file)
@@ -2110,7 +2110,7 @@ def try_multipart_encode(data, boundary):
             v = v.encode('utf-8')
         # RFC 2047 requires non-ASCII field names to be encoded, while RFC 7578
         # suggests sending UTF-8 directly. Firefox sends UTF-8, too
-        content = b'Content-Disposition: form-data; name="%s"\r\n\r\n' % k + v + b'\r\n'
+        content = b'Content-Disposition: form-data; name="' + k + b'"\r\n\r\n' + v + b'\r\n'
         if boundary.encode('ascii') in content:
             raise ValueError('Boundary overlaps with data')
         out += content