Skip to content

Commit a5d1edb

Browse files
committed
feat: hide the To header in encrypted messages
1 parent efbd621 commit a5d1edb

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
@@ -774,15 +774,6 @@ async fn test_self_talk() -> Result<()> {
774774
assert!(msg.get_showpadlock());
775775

776776
let sent_msg = t.pop_sent_msg().await;
777-
let payload = sent_msg.payload();
778-
// Make sure the `To` field contains the address and not
779-
// "undisclosed recipients".
780-
// Otherwise Delta Chat core <1.153.0 assigns the message
781-
// to the trash chat.
782-
assert_eq!(
783-
payload.match_indices("To: <alice@example.org>\r\n").count(),
784-
1
785-
);
786777

787778
let t2 = TestContext::new_alice().await;
788779
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;
@@ -884,24 +884,7 @@ impl MimeFactory {
884884
} else if header_name == "to" {
885885
protected_headers.push(header.clone());
886886
if is_encrypted {
887-
let mut to_without_names = to
888-
.clone()
889-
.into_iter()
890-
.filter_map(|header| match header {
891-
Address::Address(mb) => Some(Address::Address(EmailAddress {
892-
name: None,
893-
email: mb.email,
894-
})),
895-
_ => None,
896-
})
897-
.collect::<Vec<_>>();
898-
if to_without_names.is_empty() {
899-
to_without_names.push(hidden_recipients());
900-
}
901-
unprotected_headers.push((
902-
original_header_name,
903-
Address::new_list(to_without_names).into(),
904-
));
887+
unprotected_headers.push(hidden_recipients());
905888
} else {
906889
unprotected_headers.push(header.clone());
907890
}

0 commit comments

Comments
 (0)