mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 10:56:29 +03:00
fix: do not run simplify() on dehtml() output
simplify() is written to process incoming plaintext messages and extract footers and quotes from them. Incoming messages contain various quote styles and simplify() implements heuristics to detects them. If dehtml() output is processed by simplify(), simplify() heuristics may erroneously detect footers and quotes in produced plaintext. dehtml() should directly detect quotes instead of converting them to plaintext quotes for parsing with simplify().
This commit is contained in:
@@ -1076,16 +1076,20 @@ impl MimeMessage {
|
||||
Default::default()
|
||||
} else {
|
||||
let is_html = mime_type == mime::TEXT_HTML;
|
||||
let out = if is_html {
|
||||
if is_html {
|
||||
self.is_mime_modified = true;
|
||||
dehtml(&decoded_data).unwrap_or_else(|| {
|
||||
if let Some(text) = dehtml(&decoded_data) {
|
||||
text
|
||||
} else {
|
||||
dehtml_failed = true;
|
||||
decoded_data.clone()
|
||||
})
|
||||
SimplifiedText {
|
||||
text: decoded_data.clone(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
decoded_data.clone()
|
||||
};
|
||||
simplify(out, self.has_chat_version())
|
||||
simplify(decoded_data.clone(), self.has_chat_version())
|
||||
}
|
||||
};
|
||||
|
||||
self.is_mime_modified = self.is_mime_modified
|
||||
|
||||
Reference in New Issue
Block a user