Skip to content

Commit 91d1565

Browse files
committed
feat: hide the To header in encrypted messages
1 parent cef8f9c commit 91d1565

File tree

2 files changed

+2
-28
lines changed

2 files changed

+2
-28
lines changed

src/chat/chat_tests.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -790,15 +790,6 @@ async fn test_self_talk() -> Result<()> {
790790
assert!(msg.get_showpadlock());
791791

792792
let sent_msg = t.pop_sent_msg().await;
793-
let payload = sent_msg.payload();
794-
// Make sure the `To` field contains the address and not
795-
// "undisclosed recipients".
796-
// Otherwise Delta Chat core <1.153.0 assigns the message
797-
// to the trash chat.
798-
assert_eq!(
799-
payload.match_indices("To: <alice@example.org>\r\n").count(),
800-
1
801-
);
802793

803794
let t2 = TestContext::new_alice().await;
804795
t2.recv_msg(&sent_msg).await;

src/mimefactory.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use anyhow::{bail, Context as _, Result};
88
use base64::Engine as _;
99
use chrono::TimeZone;
1010
use deltachat_contact_tools::sanitize_bidi_characters;
11-
use mail_builder::headers::address::{Address, EmailAddress};
11+
use mail_builder::headers::address::Address;
1212
use mail_builder::headers::HeaderType;
1313
use mail_builder::mime::MimePart;
1414
use tokio::fs;
@@ -850,24 +850,7 @@ impl MimeFactory {
850850
} else if header_name == "to" {
851851
protected_headers.push(header.clone());
852852
if is_encrypted {
853-
let mut to_without_names = to
854-
.clone()
855-
.into_iter()
856-
.filter_map(|header| match header {
857-
Address::Address(mb) => Some(Address::Address(EmailAddress {
858-
name: None,
859-
email: mb.email,
860-
})),
861-
_ => None,
862-
})
863-
.collect::<Vec<_>>();
864-
if to_without_names.is_empty() {
865-
to_without_names.push(hidden_recipients());
866-
}
867-
unprotected_headers.push((
868-
original_header_name,
869-
Address::new_list(to_without_names).into(),
870-
));
853+
unprotected_headers.push(("To", hidden_recipients().into()));
871854
} else {
872855
unprotected_headers.push(header.clone());
873856
}

0 commit comments

Comments
 (0)