diff options
author | Lars Chr. Duus Hausmann <lars.chr@duus-hausmann.dk> | 2017-01-09 15:59:17 +0100 |
---|---|---|
committer | Lars Chr. Duus Hausmann <lars.chr@duus-hausmann.dk> | 2017-01-09 15:59:17 +0100 |
commit | bac506e120f5eeb853447645d29c6cce61378603 (patch) | |
tree | 4f81ac994d31724da1bfd1c6328a8d5e4cbb8ec1 | |
parent | 0ee16cdf6db38d29c94b5d9b65f595c8689e9242 (diff) | |
download | wee-slack-bac506e120f5eeb853447645d29c6cce61378603.tar.gz |
Handles upload with spaces in filename
-rw-r--r-- | wee_slack.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py index 51e86aa..066557f 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2244,6 +2244,8 @@ def async_slack_api_upload_request(token, request, post_data, priority=False): if not STOP_TALKING_TO_SLACK: url = 'https://slack.com/api/{}'.format(request) file_path = os.path.expanduser(post_data["file"]) + if ' ' in file_path: + file_path = file_path.replace(' ','\ ') command = 'curl -F file=@{} -F channels={} -F token={} {}'.format(file_path, post_data["channels"], token, url) context = pickle.dumps({"request": request, "token": token, "post_data": post_data}) w.hook_process(command, slack_timeout, "url_processor_cb", context) |