1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 03:32:05 +00:00

[utils] Fix multipart_encode for Python < 3.5

This commit is contained in:
Yen Chi Hsuan 2017-05-05 20:51:59 +08:00
parent 4ac6dc3732
commit b2ad479d17
No known key found for this signature in database
GPG key ID: 7F902A182457CA23

View 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