diff --git a/mwclient/client.py b/mwclient/client.py index 440d908ad22966888bb94fa9f7c5658c17ef485d..7db4b6e4e9ba048742e54f2285b7a57f4c2bb0f1 100644 --- a/mwclient/client.py +++ b/mwclient/client.py @@ -514,15 +514,10 @@ class Site(object): # Workaround for https://github.com/mwclient/mwclient/issues/65 # ---------------------------------------------------------------- - # Since the filename in Content-Disposition is not used as the - # destination filename, we can pass in some ascii-only dummy name - # to make sure the server accepts it. - fname = 'upload' - name = getattr(file, 'name', None) - if name and name[0] != '<' and name[-1] != '>' and name.find('.') != -1: - ext = name[name.rfind('.') + 1:] - fname = 'upload.{}'.format(ext) - file = (fname, file) + # Since the filename in Content-Disposition is not interpreted, + # we can send some ascii-only dummy name rather than the real + # filename, which might contain non-ascii. + file = ('fake-filename', file) # End of workaround # ----------------------------------------------------------------