mirror of
https://github.com/chatmail/core.git
synced 2026-05-17 13:56:30 +03:00
fixup: download legacy Secure-Join messages even if encryption is enforced
This commit is contained in:
19
src/imap.rs
19
src/imap.rs
@@ -1994,12 +1994,15 @@ pub(crate) async fn prefetch_should_download(
|
||||
// prevent_rename=true as this might be a mailing list message and in this case it would be bad if we rename the contact.
|
||||
// (prevent_rename is the last argument of from_field_to_contact_id())
|
||||
|
||||
let is_encrypted = if let Some(content_type) = headers.get_header_value(HeaderDef::ContentType)
|
||||
{
|
||||
mailparse::parse_content_type(&content_type).mimetype == "multipart/encrypted"
|
||||
} else {
|
||||
false
|
||||
};
|
||||
// New SecureJoin is fully encrypted,
|
||||
// but for compatibility we still download legacy `Secure-Join: vc-request` messages.
|
||||
let is_legacy_securejoin = headers.get_header_value(HeaderDef::SecureJoin).is_some();
|
||||
|
||||
let is_encrypted = headers
|
||||
.get_header_value(HeaderDef::ContentType)
|
||||
.is_some_and(|content_type| {
|
||||
mailparse::parse_content_type(&content_type).mimetype == "multipart/encrypted"
|
||||
});
|
||||
|
||||
if flags.any(|f| f == Flag::Draft) {
|
||||
info!(context, "Ignoring draft message");
|
||||
@@ -2008,7 +2011,9 @@ pub(crate) async fn prefetch_should_download(
|
||||
|
||||
let should_download = maybe_ndn
|
||||
|| (!blocked_contact
|
||||
&& (is_encrypted || !context.get_config_bool(Config::ForceEncryption).await?));
|
||||
&& (is_legacy_securejoin
|
||||
|| is_encrypted
|
||||
|| !context.get_config_bool(Config::ForceEncryption).await?));
|
||||
Ok(should_download)
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ const PREFETCH_FLAGS: &str = "(UID RFC822.SIZE BODY.PEEK[HEADER.FIELDS (\
|
||||
X-MICROSOFT-ORIGINAL-MESSAGE-ID \
|
||||
FROM \
|
||||
CONTENT-TYPE \
|
||||
SECURE-JOIN \
|
||||
CHAT-VERSION \
|
||||
CHAT-IS-POST-MESSAGE \
|
||||
AUTOCRYPT-SETUP-MESSAGE\
|
||||
|
||||
Reference in New Issue
Block a user