File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -288,9 +288,7 @@ impl MimeMessage {
288
288
if let Some ( part) = part. subparts . first ( ) {
289
289
for field in & part. headers {
290
290
let key = field. get_key ( ) . to_lowercase ( ) ;
291
-
292
- // For now only avatar headers can be hidden.
293
- if !headers. contains_key ( & key) && is_hidden ( & key) {
291
+ if !headers. contains_key ( & key) && is_hidden ( & key) || key == "message-id" {
294
292
headers. insert ( key. to_string ( ) , field. get_value ( ) ) ;
295
293
}
296
294
}
Original file line number Diff line number Diff line change @@ -1918,6 +1918,29 @@ This is the epilogue. It is also to be ignored.";
1918
1918
) ;
1919
1919
}
1920
1920
1921
+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
1922
+ async fn test_hidden_message_id ( ) {
1923
+ let t = & TestContext :: new ( ) . await ;
1924
+ let raw = br#"Message-ID: bar@example.org
1925
+ Date: Sun, 08 Dec 2019 23:12:55 +0000
1926
+ To: <alice@example.org>
1927
+ From: <tunis4@example.org>
1928
+ Content-Type: multipart/mixed; boundary="luTiGu6GBoVLCvTkzVtmZmwsmhkNMw"
1929
+
1930
+
1931
+ --luTiGu6GBoVLCvTkzVtmZmwsmhkNMw
1932
+ Message-ID: foo@example.org
1933
+ Content-Type: text/plain; charset=utf-8
1934
+
1935
+ Message with a correct Message-ID hidden header
1936
+
1937
+ --luTiGu6GBoVLCvTkzVtmZmwsmhkNMw--
1938
+ "# ;
1939
+
1940
+ let message = MimeMessage :: from_bytes ( t, & raw [ ..] , None ) . await . unwrap ( ) ;
1941
+ assert_eq ! ( message. get_rfc724_mid( ) . unwrap( ) , "foo@example.org" ) ;
1942
+ }
1943
+
1921
1944
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
1922
1945
async fn test_chat_edit_imf_header ( ) -> Result < ( ) > {
1923
1946
let mut tcm = TestContextManager :: new ( ) ;
You can’t perform that action at this time.
0 commit comments