mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 17:06:28 +03:00
squash_attachment_parts: use slice patterns
This commit is contained in:
committed by
Alexander Krotov
parent
3a91c87c73
commit
0327000f8d
@@ -203,10 +203,12 @@ impl MimeMessage {
|
||||
/// Delta Chat sends attachments, such as images, in two-part messages, with the first message
|
||||
/// containing an explanation. If such a message is detected, first part can be safely dropped.
|
||||
fn squash_attachment_parts(&mut self) {
|
||||
if self.has_chat_version() && self.parts.len() == 2 {
|
||||
if !self.has_chat_version() {
|
||||
return;
|
||||
}
|
||||
|
||||
if let [textpart, filepart] = &self.parts[..] {
|
||||
let need_drop = {
|
||||
let textpart = &self.parts[0];
|
||||
let filepart = &self.parts[1];
|
||||
textpart.typ == Viewtype::Text
|
||||
&& (filepart.typ == Viewtype::Image
|
||||
|| filepart.typ == Viewtype::Gif
|
||||
|
||||
Reference in New Issue
Block a user