Bug 387423 - Attachment icon not shown in message list for multipart/alternative attachments
Summary: Attachment icon not shown in message list for multipart/alternative attachments
Status: ASSIGNED
Alias: None
Product: kmime
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 393417 395687 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-11-29 00:19 UTC by David E. Narvaez
Modified: 2021-01-25 18:21 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Suggested path (1.62 KB, patch)
2017-11-29 00:19 UTC, David E. Narvaez
Details
Test message (1.61 KB, application/mbox)
2020-07-09 09:54 UTC, Jonathan Marten
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David E. Narvaez 2017-11-29 00:19:21 UTC
Created attachment 109105 [details]
Suggested path

Ultimately my goal is for KMail to display the attachment icon next to emails that have attachments. I have narrowed down the issue of emails with attachments for which KMail does not display that icon to multipart/alternative emails in which the attachment is in the HTML part. Before revision 83859810 of KMime, the code had a flag to detect attachments even inside alternative parts, but that does not seem to be the case and it explicitly ignores alternative parts now, which is wrong for some (many?) use cases, including Akonadi flagging an item as HasAttachment (which is what ultimately is used to show the KMail icon) because the email in fact has an attachment in one of its forms.

I could patch the code but I am not sure about the implications elsewhere or what the desired behavior is (assuming the current behavior is not the desired one). For instance, the attached patch descends into the parts of a multipart/alternative email to check for attachments, but attachment-looking parts that are immediately under the multipart/alternative container are not considered attachments. This does not break the tests according to ctest (but the patch does not add a specific test like having a multipart/alternative composed of a text/plain and an image/jpeg).
Comment 1 David E. Narvaez 2017-11-29 00:20:11 UTC
Also, this may be related to #373136
Comment 2 Jonathan Marten 2020-07-09 09:54:15 UTC
Created attachment 129994 [details]
Test message

Test message, clean and containing no personal information or external references.

Import the message ito KMail, observe that the message list shows no attachment icon but the GIF is correctly shown in the message viewer.
Comment 3 Laurent Montel 2020-07-09 10:52:52 UTC
I confirm it.
I will investigate it.
Comment 4 Laurent Montel 2020-07-09 11:51:24 UTC
Git commit 80152cb39a9d22b26ea7bf7d66d8f462e51f6bf5 by Laurent Montel.
Committed on 09/07/2020 at 11:22.
Pushed by mlaurent into branch 'master'.

Add autotest for 387423

A  +46   -0    autotests/data/mails/kmail-attachmentstatus.mbox
M  +18   -0    autotests/messagetest.cpp
M  +1    -0    autotests/messagetest.h

https://invent.kde.org/pim/kmime/commit/80152cb39a9d22b26ea7bf7d66d8f462e51f6bf5
Comment 5 Justin Zobel 2020-11-13 03:02:22 UTC
(In reply to Laurent Montel from comment #4)
> Git commit 80152cb39a9d22b26ea7bf7d66d8f462e51f6bf5 by Laurent Montel.
> Committed on 09/07/2020 at 11:22.
> Pushed by mlaurent into branch 'master'.
> 
> Add autotest for 387423
> 
> A  +46   -0    autotests/data/mails/kmail-attachmentstatus.mbox
> M  +18   -0    autotests/messagetest.cpp
> M  +1    -0    autotests/messagetest.h
> 
> https://invent.kde.org/pim/kmime/commit/
> 80152cb39a9d22b26ea7bf7d66d8f462e51f6bf5

Thanks for the patch Laurent, can this now be resolved?
Comment 6 Dennis Schridde 2021-01-25 18:21:39 UTC
*** Bug 395687 has been marked as a duplicate of this bug. ***
Comment 7 Dennis Schridde 2021-01-25 18:21:41 UTC
*** Bug 393417 has been marked as a duplicate of this bug. ***