From 7924b601ab74305d851af0b88444f17754c16a38 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 29 Feb 2020 16:55:22 +0100 Subject: [PATCH] core (constants): renamed `MESS_KEY_MEDIA_TYPE` to `MESS_KEY_ATTACHMENTS_MEDIA_TYPE` --- sat/core/constants.py | 2 +- sat/core/xmpp.py | 4 ++-- sat/plugins/plugin_sec_aesgcm.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sat/core/constants.py b/sat/core/constants.py index f1f37dfb..1688ec57 100644 --- a/sat/core/constants.py +++ b/sat/core/constants.py @@ -134,7 +134,7 @@ class Const(object): 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" diff --git a/sat/core/xmpp.py b/sat/core/xmpp.py index 1a72db59..5580eaf0 100644 --- a/sat/core/xmpp.py +++ b/sat/core/xmpp.py @@ -1137,10 +1137,10 @@ class SatMessageProtocol(xmppim.MessageProtocol): 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): diff --git a/sat/plugins/plugin_sec_aesgcm.py b/sat/plugins/plugin_sec_aesgcm.py index f5a833c7..76ff66cc 100644 --- a/sat/plugins/plugin_sec_aesgcm.py +++ b/sat/plugins/plugin_sec_aesgcm.py @@ -236,7 +236,7 @@ class AESGCM(object): } 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