Skip to content

Commit 9639eb3

Browse files
author
Armin Samii
committed
Fix bug preventing API calls requiring a file ID
For example, an API call to files.info takes a file ID argument named "file", which was stripped out by this call. Currently, there is only one request type that accepts file data (files.upload). Every other use of 'file' is an ID that aught to be contained in the request.
1 parent 7dfa7f3 commit 9639eb3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

slackclient/_slackrequest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ def do(token, request="?", post_data=None, domain="slack.com"):
2222
post_data = post_data or {}
2323

2424
# Pull file out so it isn't JSON encoded like normal fields.
25-
files = {'file': post_data.pop('file')} if 'file' in post_data else None
25+
# Only do this for requests that are UPLOADING files; downloading files
26+
# use the 'file' argument to point to a File ID.
27+
upload_requests = ['files.upload']
28+
files = None
29+
if request in upload_requests:
30+
files = {'file': post_data.pop('file')} if 'file' in post_data else None
2631

2732
for k, v in six.iteritems(post_data):
2833
if not isinstance(v, six.string_types):

0 commit comments

Comments
 (0)