mirror of
https://github.com/stalwartlabs/mail-parser.git
synced 2026-11-28 08:01:24 +00:00
Minor fixes.
This commit is contained in:
+10
@@ -1360,6 +1360,16 @@ pub trait MimeHeaders<'x> {
|
||||
.and_then(|cd| cd.attribute("filename"))
|
||||
.or_else(|| self.content_type().and_then(|ct| ct.attribute("name")))
|
||||
}
|
||||
// Returns true is the content type matches
|
||||
fn is_content_type(&self, type_: &str, subtype: &str) -> bool {
|
||||
self.content_type().map_or(false, |ct| {
|
||||
ct.c_type.eq_ignore_ascii_case(type_)
|
||||
&& ct
|
||||
.c_subtype
|
||||
.as_ref()
|
||||
.map_or(false, |st| st.eq_ignore_ascii_case(subtype))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<'x> MimeHeaders<'x> for Message<'x> {
|
||||
|
||||
@@ -20,7 +20,7 @@ pub static MONTH: &[&str] = &[
|
||||
|
||||
impl DateTime {
|
||||
/// Parses an RFC822 date
|
||||
pub fn parse_rfc822(&self, value: &str) -> Option<Self> {
|
||||
pub fn parse_rfc822(value: &str) -> Option<Self> {
|
||||
match MessageStream::new(value.as_bytes()).parse_date() {
|
||||
HeaderValue::DateTime(dt) => dt.into(),
|
||||
_ => None,
|
||||
|
||||
Reference in New Issue
Block a user