Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File with multi-byte characters in the filename can not be uploaded. #672

Closed
4 of 9 tasks
yuji38kwmt opened this issue May 7, 2020 · 2 comments · Fixed by #673
Closed
4 of 9 tasks

File with multi-byte characters in the filename can not be uploaded. #672

yuji38kwmt opened this issue May 7, 2020 · 2 comments · Fixed by #673
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented Version: 2x web-client
Milestone

Comments

@yuji38kwmt
Copy link

Description

File with multi-byte characters in the filename can not be uploaded.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Reproducible in:

slackclient version: 2.5.0

python version: 3.8.1

OS version(s): Xubuntu 18.04

Steps to reproduce:

  1. Run the following python code.
client = slack.WebClient(token=MY_TOKEN)
client.files_upload(channels="#random", file="あ.txt")

あ.txt exists in the current directory.

Expected result:

I expected that あ.txt is uploaded.

Actual result:

The following error occurred.

  File "/home/vagrant/.pyenv/versions/3.8.1/lib/python3.8/site-packages/slack/web/client.py", line 970, in files_upload
    return self.api_call("files.upload", files={"file": file}, data=kwargs)
  File "/home/vagrant/.pyenv/versions/3.8.1/lib/python3.8/site-packages/slack/web/base_client.py", line 171, in api_call
    return self._event_loop.run_until_complete(future)
  File "/home/vagrant/.pyenv/versions/3.8.1/lib/python3.8/asyncio/base_events.py", line 612, in run_until_complete
    return future.result()
  File "/home/vagrant/.pyenv/versions/3.8.1/lib/python3.8/site-packages/slack/web/base_client.py", line 207, in _send
    f = open(v.encode("ascii", "ignore"), "rb")
FileNotFoundError: [Errno 2] No such file or directory: b'/home/vagrant/Downloads/.txt'
@seratch seratch added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented Version: 2x web-client labels May 7, 2020
@seratch seratch added this to the 2.6.0 milestone May 7, 2020
@seratch
Copy link
Member

seratch commented May 7, 2020

Thanks again! I'll check this later today.

seratch added a commit to seratch/python-slack-sdk that referenced this issue May 8, 2020
seratch added a commit that referenced this issue May 11, 2020
Fix #672 files.upload fails with a filepath containing multi byte chars
@seratch
Copy link
Member

seratch commented May 15, 2020

👋 slackclient 2.6.0rc1 is out. The pre-release version contains fixes for your issue described here.
https://pypi.org/project/slackclient/2.6.0rc1/

One week later from now, we'll be releasing version 2.6.0 to PyPI.

If you have a chance, could you try the release candidate version out and let us know your feedback if you find something wrong with it? Thank you very much for being patient with this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented Version: 2x web-client
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants