core (constants): renamed MESS_KEY_MEDIA_TYPE to MESS_KEY_ATTACHMENTS_MEDIA_TYPE

This commit is contained in:
Goffi 2020-02-29 16:55:22 +01:00
commit 7924b601ab
3 changed files with 4 additions and 4 deletions

View file

@ -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"

View file

@ -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):

View file

@ -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