Skip to content

Commit

Permalink
store MIME value in lowercase presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
yggverse committed Jan 18, 2025
1 parent d3133f5 commit e456719
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/connection/response/meta/mime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Mime {
// Parse meta bytes only
match buffer.get(..if len > MAX_LEN { MAX_LEN } else { len }) {
Some(value) => match GString::from_utf8(value.into()) {
Ok(string) => Self::from_string(string.as_str()),
Ok(string) => Self::from_string(&string),
Err(e) => Err(Error::Decode(e)),
},
None => Err(Error::Protocol),
Expand All @@ -43,16 +43,16 @@ impl Mime {
return Ok(None);
}
match parse(subject) {
Some(value) => Ok(Some(Self(value))),
Some(value) => Ok(Some(Self(value.to_lowercase()))),
None => Err(Error::Undefined),
}
}

// Getters

/// Get `Self` as `&str`
/// Get `Self` as lowercase `std::str`
pub fn as_str(&self) -> &str {
&self.0
self.0.as_str()
}
}

Expand Down

0 comments on commit e456719

Please sign in to comment.