File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1994,12 +1994,15 @@ pub(crate) async fn prefetch_should_download(
19941994 // prevent_rename=true as this might be a mailing list message and in this case it would be bad if we rename the contact.
19951995 // (prevent_rename is the last argument of from_field_to_contact_id())
19961996
1997- let is_encrypted = if let Some ( content_type) = headers. get_header_value ( HeaderDef :: ContentType )
1998- {
1999- mailparse:: parse_content_type ( & content_type) . mimetype == "multipart/encrypted"
2000- } else {
2001- false
2002- } ;
1997+ // New SecureJoin is fully encrypted,
1998+ // but for compatibility we still download legacy `Secure-Join: vc-request` messages.
1999+ let is_legacy_securejoin = headers. get_header_value ( HeaderDef :: SecureJoin ) . is_some ( ) ;
2000+
2001+ let is_encrypted = headers
2002+ . get_header_value ( HeaderDef :: ContentType )
2003+ . is_some_and ( |content_type| {
2004+ mailparse:: parse_content_type ( & content_type) . mimetype == "multipart/encrypted"
2005+ } ) ;
20032006
20042007 if flags. any ( |f| f == Flag :: Draft ) {
20052008 info ! ( context, "Ignoring draft message" ) ;
@@ -2008,7 +2011,9 @@ pub(crate) async fn prefetch_should_download(
20082011
20092012 let should_download = maybe_ndn
20102013 || ( !blocked_contact
2011- && ( is_encrypted || !context. get_config_bool ( Config :: ForceEncryption ) . await ?) ) ;
2014+ && ( is_legacy_securejoin
2015+ || is_encrypted
2016+ || !context. get_config_bool ( Config :: ForceEncryption ) . await ?) ) ;
20122017 Ok ( should_download)
20132018}
20142019
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ const PREFETCH_FLAGS: &str = "(UID RFC822.SIZE BODY.PEEK[HEADER.FIELDS (\
2222 X-MICROSOFT-ORIGINAL-MESSAGE-ID \
2323 FROM \
2424 CONTENT-TYPE \
25+ SECURE-JOIN \
2526 CHAT-VERSION \
2627 CHAT-IS-POST-MESSAGE \
2728 AUTOCRYPT-SETUP-MESSAGE\
You can’t perform that action at this time.
0 commit comments