Commit d7ac5d85 authored by Katsunori SUZUI's avatar Katsunori SUZUI
Browse files

Fix tweepy.API.update_with_media

If filename is an instance of `unicode',
L.76 `` 'Content-Disposition: form-data; name="%s"; filename="%s"' % (form_field, filename) ''
must be unicode string.

Because of it, L. 803 `` body = '\r\n'.join(body) '' fails.

Therefore, I made `filename' designed to be percent-encoded str object
before formatting.
parent ffed4228
......@@ -4,6 +4,7 @@
import os
import mimetypes
import urllib
from tweepy.binder import bind_api
from tweepy.error import TweepError
......@@ -788,6 +789,8 @@ class API(object):
if file_type not in ['image/gif', 'image/jpeg', 'image/png']:
raise TweepError('Invalid file type for image: %s' % file_type)
if isinstance(filename, unicode):
filename = urllib.quote(filename.encode("utf-8"))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment