changeset 3196:adf1aeaa0d37

core (constants): renamed `MESS_KEY_MEDIA_TYPE` to `MESS_KEY_ATTACHMENTS_MEDIA_TYPE`
author Goffi <goffi@goffi.org>
date Sat, 29 Feb 2020 16:55:22 +0100
parents 29d72336a40d
children f4a28767ec35
files sat/core/constants.py sat/core/xmpp.py sat/plugins/plugin_sec_aesgcm.py
diffstat 3 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/constants.py	Fri Feb 28 18:10:58 2020 +0100
+++ b/sat/core/constants.py	Sat Feb 29 16:55:22 2020 +0100
@@ -134,7 +134,7 @@
     MESS_KEY_TRUSTED = "trusted"
 
     MESS_KEY_ATTACHMENTS = "attachments"
-    MESS_KEY_MEDIA_TYPE = "media_type"
+    MESS_KEY_ATTACHMENTS_MEDIA_TYPE = "media_type"
 
     # File encryption algorithms
     ENC_AES_GCM = "AES-GCM"
--- a/sat/core/xmpp.py	Fri Feb 28 18:10:58 2020 +0100
+++ b/sat/core/xmpp.py	Sat Feb 29 16:55:22 2020 +0100
@@ -1137,10 +1137,10 @@
                 name = (Path(unquote(urlparse(attachment['url']).path)).name
                         or C.FILE_DEFAULT_NAME)
                 attachment["name"] = name
-            if C.MESS_KEY_MEDIA_TYPE not in attachment:
+            if C.MESS_KEY_ATTACHMENTS_MEDIA_TYPE not in attachment:
                 media_type = mimetypes.guess_type(attachment['name'], strict=False)[0]
                 if media_type:
-                    attachment[C.MESS_KEY_MEDIA_TYPE] = media_type
+                    attachment[C.MESS_KEY_ATTACHMENTS_MEDIA_TYPE] = media_type
         return data
 
     def skipEmptyMessage(self, data):
--- a/sat/plugins/plugin_sec_aesgcm.py	Fri Feb 28 18:10:58 2020 +0100
+++ b/sat/plugins/plugin_sec_aesgcm.py	Sat Feb 29 16:55:22 2020 +0100
@@ -236,7 +236,7 @@
                     }
                     media_type = mimetypes.guess_type(path, strict=False)[0]
                     if media_type is not None:
-                        attachment[C.MESS_KEY_MEDIA_TYPE] = media_type
+                        attachment[C.MESS_KEY_ATTACHMENTS_MEDIA_TYPE] = media_type
 
                     if mess_encrypted:
                         # we don't add the encrypted flag if the message itself is not