changeset 3345:3dc8835d96cc

plugin XEP-0234: fixed mime type in `buildFileElementFromDict`
author Goffi <goffi@goffi.org>
date Tue, 25 Aug 2020 08:51:35 +0200
parents 7515e1878004
children 4f1fcee83d36
files sat/plugins/plugin_xep_0234.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0234.py	Sat Aug 15 22:54:42 2020 +0200
+++ b/sat/plugins/plugin_xep_0234.py	Tue Aug 25 08:51:35 2020 +0200
@@ -179,6 +179,12 @@
         if kwargs:
             file_data = file_data.copy()
             file_data.update(kwargs)
+        try:
+            file_data["mime_type"] = (
+                f'{file_data.pop("media_type")}/{file_data.pop("media_subtype")}'
+            )
+        except KeyError:
+            pass
         return self.buildFileElement(client, **file_data)
 
     async def parseFileElement(