fix: Remove leading whitespace from Subject (#5106)

If Subject is multiline-formatted, `mailparse` adds the leading whitespace to it. The solution is to
always remove the leading whitespace, because if Subject isn't multiline-formatted, it never
contains the leading whitespace anyway. But as for the trailing whitespace -- i checked -- it's
never removed, so let's keep this as is.
This commit is contained in:
iequidoo
2024-03-06 19:13:05 -03:00
committed by iequidoo
parent e67e86422f
commit bc7fd4495b
2 changed files with 23 additions and 0 deletions

View File

@@ -809,6 +809,7 @@ impl MimeMessage {
pub(crate) fn get_subject(&self) -> Option<String> {
self.get_header(HeaderDef::Subject)
.map(|s| s.trim_start())
.filter(|s| !s.is_empty())
.map(|s| s.to_string())
}