Skip to content

Commit e5a913b

Browse files
committed
feat: hide the To header in encrypted messages
1 parent c7cb423 commit e5a913b

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;
@@ -881,24 +881,7 @@ impl MimeFactory {
881881
} else if header_name == "to" {
882882
protected_headers.push(header.clone());
883883
if is_encrypted {
884-
let mut to_without_names = to
885-
.clone()
886-
.into_iter()
887-
.filter_map(|header| match header {
888-
Address::Address(mb) => Some(Address::Address(EmailAddress {
889-
name: None,
890-
email: mb.email,
891-
})),
892-
_ => None,
893-
})
894-
.collect::<Vec<_>>();
895-
if to_without_names.is_empty() {
896-
to_without_names.push(hidden_recipients());
897-
}
898-
unprotected_headers.push((
899-
original_header_name,
900-
Address::new_list(to_without_names).into(),
901-
));
884+
unprotected_headers.push(("To", hidden_recipients().into()));
902885
} else {
903886
unprotected_headers.push(header.clone());
904887
}

0 commit comments

Comments
 (0)