diff 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
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.py	Wed Apr 01 23:59:00 2020 +0200
+++ b/cagou/plugins/plugin_wid_chat.py	Wed Apr 01 23:59:00 2020 +0200
@@ -1025,7 +1025,7 @@
     def addAttachment(self, file_path, media_type=None):
         file_path = Path(file_path)
         if media_type is None:
-            media_type = mimetypes.guess_type(file_path, strict=False)[0]
+            media_type = mimetypes.guess_type(str(file_path), strict=False)[0]
         if not self.attachments_to_send.show_resize and media_type is not None:
             # we check if the attachment is an image and if it's too large.
             # If too large, the reduce size check box will be displayed, and checked by