File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -199,10 +199,22 @@ 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 (
208+ (
209+ "files" ,
210+ (
211+ path .name ,
212+ Path (path ).read_bytes (),
213+ ),
214+ )
215+ )
206216
207- result = self .files .upload_file (channel_id , file_dict )
217+ result = self .files .upload_file (
218+ files = file_list , data = {"channel_id" : channel_id }
219+ )
208220 return list (info ["id" ] for info in result ["file_infos" ])
You can’t perform that action at this time.
0 commit comments