Browse Source

[utils] Fix multipart_encode for Python < 3.5

Yen Chi Hsuan 8 years ago
parent
commit
b2ad479d17
1 changed files with 1 additions and 1 deletions
  1. 1 1
      youtube_dl/utils.py

+ 1 - 1
youtube_dl/utils.py

@@ -2110,7 +2110,7 @@ def try_multipart_encode(data, boundary):
             v = v.encode('utf-8')
             v = v.encode('utf-8')
         # RFC 2047 requires non-ASCII field names to be encoded, while RFC 7578
         # RFC 2047 requires non-ASCII field names to be encoded, while RFC 7578
         # suggests sending UTF-8 directly. Firefox sends UTF-8, too
         # 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:
         if boundary.encode('ascii') in content:
             raise ValueError('Boundary overlaps with data')
             raise ValueError('Boundary overlaps with data')
         out += content
         out += content