From 0329b242c851ea1f05e795102638b01bbac7c231 Mon Sep 17 00:00:00 2001 From: NavaL Date: Wed, 19 Oct 2016 15:23:17 +0200 Subject: [feat] leap.mail: expose content charset as a separated attribute Before we used to have content_doc.content_type = 'text/plain; charset="utf-8"'. Currently, we have content_doc.content_type = 'text/plain'. This change will give us, on top of that: content_doc.charset = 'utf-8'. One can reconstruct the original one using .content_type and .charset. --- src/leap/bitmask/mail/adaptors/soledad.py | 1 + src/leap/bitmask/mail/walk.py | 1 + 2 files changed, 2 insertions(+) (limited to 'src/leap') diff --git a/src/leap/bitmask/mail/adaptors/soledad.py b/src/leap/bitmask/mail/adaptors/soledad.py index 4a8008d..665cef2 100644 --- a/src/leap/bitmask/mail/adaptors/soledad.py +++ b/src/leap/bitmask/mail/adaptors/soledad.py @@ -432,6 +432,7 @@ class ContentDocWrapper(SoledadDocumentWrapper): content_disposition = "" content_transfer_encoding = "" content_type = "" + charset = "" class __meta__(object): index = "phash" diff --git a/src/leap/bitmask/mail/walk.py b/src/leap/bitmask/mail/walk.py index 61bbe0b..6c9fc38 100644 --- a/src/leap/bitmask/mail/walk.py +++ b/src/leap/bitmask/mail/walk.py @@ -79,6 +79,7 @@ def get_raw_docs(msg): 'raw': part.get_payload(), 'phash': get_hash(part.get_payload()), 'content-type': part.get_content_type(), + 'charset': part.get_content_charset(), 'content-disposition': first(part.get( 'content-disposition', '').split(';')), 'content-transfer-encoding': part.get( -- cgit v1.2.3