Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/parsers/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ fn mime_type(
"text" => match content_type.subtype() {
Some("plain") => (false, true, true, MimeType::TextPlain),
Some("html") => (false, true, true, MimeType::TextHtml),
Some("calendar") => (false, true, true, MimeType::TextOther),
_ => (false, false, true, MimeType::TextOther),
},
"image" | "audio" | "video" => (false, true, false, MimeType::Inline),
Expand Down
35 changes: 35 additions & 0 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,38 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
"Book about ☕ tables.gif"
);
}

#[test]
fn test_text_calendar_is_treated_as_inline_body() {
let input = br#"From: organizer@example.com
To: attendee@example.com
Subject: Calendar reply
MIME-Version: 1.0
Content-Type: text/calendar; method=REPLY; charset="utf-8"
Content-Transfer-Encoding: 8bit

BEGIN:VCALENDAR
VERSION:2.0
METHOD:REPLY
BEGIN:VEVENT
SUMMARY:Accepted: Team Sync
DTSTART:20260109T025000Z
DTEND:20260109T041500Z
END:VEVENT
END:VCALENDAR
"#;

let message = MessageParser::default().parse(input).unwrap();

assert_eq!(message.text_body_count(), 1);
assert_eq!(message.html_body_count(), 1);
assert_eq!(message.attachment_count(), 0);
assert_eq!(message.parts.len(), 1);

assert!(message.body_text(0).unwrap().contains("BEGIN:VCALENDAR"));
assert!(message
.body_text(0)
.unwrap()
.contains("SUMMARY:Accepted: Team Sync"));
assert!(message.body_html(0).unwrap().contains("BEGIN:VCALENDAR"));
}