Skip to content

Commit

Permalink
Merge pull request #68 from Pipoline/fix_upload_file_call
Browse files Browse the repository at this point in the history
Fix: upload_file mime_type
  • Loading branch information
pipozzz authored Jul 7, 2023
2 parents 3d04595 + e88f34c commit 5d62c17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: python
dist: focal
python:
- "3.9"
- "3.8"

# command to install dependencies
install:
Expand Down
7 changes: 6 additions & 1 deletion rocketchat/api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import mimetypes

from rocketchat.calls.chat.send_message import SendMessage
from rocketchat.calls.channels.get_public_rooms import GetPublicRooms
from rocketchat.calls.groups.get_private_rooms import GetPrivateRooms
Expand Down Expand Up @@ -82,7 +84,7 @@ def get_room_info(self, room_id, **kwargs):
**kwargs
)

def upload_file(self, room_id, description, file, message, mime_type='text/plain', **kwargs):
def upload_file(self, room_id, description, file, message, mime_type=None, **kwargs):
"""
Upload file to room
:param room_id:
Expand All @@ -91,6 +93,9 @@ def upload_file(self, room_id, description, file, message, mime_type='text/plain
:param kwargs:
:return:
"""
if not mime_type:
mime_type = mimetypes.guess_type(file)[0]

return UploadFile(settings=self.settings, **kwargs).call(
room_id=room_id,
description=description,
Expand Down

0 comments on commit 5d62c17

Please sign in to comment.