diff options
author | Damien Caliste <dcaliste@free.fr> | 2023-08-18 15:21:23 +0200 |
---|---|---|
committer | Damien Caliste <dcaliste@free.fr> | 2023-09-01 11:22:05 +0200 |
commit | 621e3018b95155a7ce54e6c169ba0df4bf3d1d61 (patch) | |
tree | 93f421a0d43c68d1df12673f538538f45448b7f0 /src/libraries/qmfclient/qmailmessage.cpp | |
parent | ee97df2974cf69d9a81d7208085a6a78ab7c8c42 (diff) |
Treat non text parts without content disposition as attachments
Some mails don't provide the Content-Disposition:
tag, providing just a Content-Type:. This commit
modifies the findAttachment strategy to treat all
such parts as attachments if they are not of text
type, or known cryptographic parts. Example of such
disposition:
-------------02837317639187261987642987516514411
Content-Type: application/pdf; name=ebillet_1_2.pdf
Content-Transfer-Encoding: base64
Change-Id: I4eecc04134dcf40d2e39b856c29a0e60531221e8
Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
Diffstat (limited to 'src/libraries/qmfclient/qmailmessage.cpp')
-rw-r--r-- | src/libraries/qmfclient/qmailmessage.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libraries/qmfclient/qmailmessage.cpp b/src/libraries/qmfclient/qmailmessage.cpp index c0e1f08e..87f98c56 100644 --- a/src/libraries/qmfclient/qmailmessage.cpp +++ b/src/libraries/qmfclient/qmailmessage.cpp @@ -1185,12 +1185,16 @@ namespace findAttachments bool isAttachment = (!part.contentDisposition().isNull()) && (part.contentDisposition().type() == QMailMessageContentDisposition::Attachment); + bool isNone = (part.contentDisposition().isNull()) || + (part.contentDisposition().type() == QMailMessageContentDisposition::None); + bool isRFC822 = contentType.matches("message", "rfc822"); // Attached messages are considered as attachments even if content disposition // is inline instead of attachment, but only if they aren't text/plain nor text/html if (isRFC822 || (isAttachment && !excludedApp) - || (isInLine && !excludedText && !excludedApp)) { + || (isInLine && !excludedText && !excludedApp) + || (isNone && !excludedText && !excludedApp)) { if (found) { *found << part.location(); } |