From 6990312051efddbb59a221c6adca0ec538eaed26 Mon Sep 17 00:00:00 2001 From: link2xt Date: Wed, 27 Sep 2023 09:27:09 +0000 Subject: [PATCH] fix: trash only empty *text* parts when location.kml is attached If the message contains other attachment parts such as images, they should not go into trash. --- src/receive_imf.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 2011f39b2..3ebddf129 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -1128,7 +1128,8 @@ async fn add_parts( (&part.msg, part.typ) }; - let part_is_empty = part.msg.is_empty() && part.param.get(Param::Quote).is_none(); + let part_is_empty = + typ == Viewtype::Text && msg.is_empty() && part.param.get(Param::Quote).is_none(); let mime_modified = save_mime_modified && !part_is_empty; if mime_modified { // Avoid setting mime_modified for more than one part. @@ -1153,7 +1154,8 @@ async fn add_parts( // If you change which information is skipped if the message is trashed, // also change `MsgId::trash()` and `delete_expired_messages()` - let trash = chat_id.is_trash() || (is_location_kml && msg.is_empty()); + let trash = + chat_id.is_trash() || (is_location_kml && msg.is_empty() && typ == Viewtype::Text); let row_id = context .sql