File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -199,10 +199,12 @@ def upload_files(
199199 ) -> List [str ]:
200200 """Given a list of file paths and the channel id, uploads the corresponding
201201 files and returns a list their internal file IDs."""
202- file_dict = {}
202+ file_list = []
203203 for path in file_paths :
204204 path = Path (path )
205- file_dict [path .name ] = Path (path ).read_bytes ()
205+ # Note: 'files' should be a name of an expected attribute in the body
206+ # but seems to be ignored when simply uploading files to mattermost
207+ file_list .append (("files" , (path .name , Path (path ).read_bytes (),)))
206208
207- result = self .files .upload_file (channel_id , file_dict )
209+ result = self .files .upload_file (files = file_list , data = { "channel_id" : channel_id } )
208210 return list (info ["id" ] for info in result ["file_infos" ])
You can’t perform that action at this time.
0 commit comments