mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 10:56:29 +03:00
Drop incoming vCards
Otherwise they show up as attachments in the chat.
This commit is contained in:
@@ -814,6 +814,15 @@ impl MimeMessage {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if mime_type.type_() == "text/x-vcard"
|
||||
|| mime_type.type_() == "text/vcard"
|
||||
|| filename.ends_with(".vcf")
|
||||
|| filename.ends_with(".vcard")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* we have a regular file attachment,
|
||||
write decoded data to new blob object */
|
||||
|
||||
@@ -1632,6 +1641,22 @@ mod tests {
|
||||
assert_eq!(mimeparser.group_avatar, None);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
async fn test_mimeparser_with_vcard() {
|
||||
let t = TestContext::new().await;
|
||||
|
||||
let raw = include_bytes!("../test-data/message/vcard.eml");
|
||||
let mimeparser = MimeMessage::from_bytes(&t.ctx, &raw[..]).await.unwrap();
|
||||
assert_eq!(mimeparser.parts.len(), 1);
|
||||
assert_eq!(mimeparser.parts[0].typ, Viewtype::Text);
|
||||
assert_eq!(
|
||||
mimeparser.parts[0].msg,
|
||||
"vCard example – An example of vCard sent from Thunderbird."
|
||||
);
|
||||
assert_eq!(mimeparser.user_avatar, None);
|
||||
assert_eq!(mimeparser.group_avatar, None);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
async fn test_mimeparser_message_kml() {
|
||||
let context = TestContext::new().await;
|
||||
|
||||
Reference in New Issue
Block a user