Mercurial > libervia-desktop-kivy
comparison cagou/plugins/plugin_wid_chat.py @ 455:642cd2435e26
chat: fixed media_type guessing when Path is used for attachment
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 01 Apr 2020 23:59:00 +0200 |
parents | 20a807443c3f |
children | 1dd6db69406a |
comparison
equal
deleted
inserted
replaced
454:65958c3c98cb | 455:642cd2435e26 |
---|---|
1023 self.attachments_to_send.reduce_checkbox.active=True | 1023 self.attachments_to_send.reduce_checkbox.active=True |
1024 | 1024 |
1025 def addAttachment(self, file_path, media_type=None): | 1025 def addAttachment(self, file_path, media_type=None): |
1026 file_path = Path(file_path) | 1026 file_path = Path(file_path) |
1027 if media_type is None: | 1027 if media_type is None: |
1028 media_type = mimetypes.guess_type(file_path, strict=False)[0] | 1028 media_type = mimetypes.guess_type(str(file_path), strict=False)[0] |
1029 if not self.attachments_to_send.show_resize and media_type is not None: | 1029 if not self.attachments_to_send.show_resize and media_type is not None: |
1030 # we check if the attachment is an image and if it's too large. | 1030 # we check if the attachment is an image and if it's too large. |
1031 # If too large, the reduce size check box will be displayed, and checked by | 1031 # If too large, the reduce size check box will be displayed, and checked by |
1032 # default. | 1032 # default. |
1033 main_type = media_type.split('/')[0] | 1033 main_type = media_type.split('/')[0] |