diff options
Diffstat (limited to 'framework/domain/mimetreeparser')
-rw-r--r-- | framework/domain/mimetreeparser/interface.cpp | 16 | ||||
-rw-r--r-- | framework/domain/mimetreeparser/tests/interfacetest.cpp | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/framework/domain/mimetreeparser/interface.cpp b/framework/domain/mimetreeparser/interface.cpp index 596dc152..ab56f800 100644 --- a/framework/domain/mimetreeparser/interface.cpp +++ b/framework/domain/mimetreeparser/interface.cpp | |||
@@ -818,12 +818,24 @@ QVector<Part::Ptr> Parser::collectAttachmentParts() const | |||
818 | } | 818 | } |
819 | 819 | ||
820 | { | 820 | { |
821 | const auto parent = content->parent(); | 821 | QMimeDatabase mimeDb; |
822 | auto _mime = content->parent()->mailMime(); | ||
823 | const auto parent = _mime->parent(); | ||
822 | if (parent) { | 824 | if (parent) { |
823 | const auto _mime = parent->mailMime(); | 825 | const auto mimetype = parent->mimetype(); |
826 | if (mimetype == mimeDb.mimeTypeForName("multipart/related")) { | ||
827 | return false; | ||
828 | } | ||
829 | } | ||
830 | while (_mime) { | ||
824 | if (_mime && (_mime->isTopLevelPart() || _mime->isFirstTextPart())) { | 831 | if (_mime && (_mime->isTopLevelPart() || _mime->isFirstTextPart())) { |
825 | return false; | 832 | return false; |
826 | } | 833 | } |
834 | if (_mime->isFirstPart()) { | ||
835 | _mime = _mime->parent(); | ||
836 | } else { | ||
837 | break; | ||
838 | } | ||
827 | } | 839 | } |
828 | } | 840 | } |
829 | const auto cd = mime->disposition(); | 841 | const auto cd = mime->disposition(); |
diff --git a/framework/domain/mimetreeparser/tests/interfacetest.cpp b/framework/domain/mimetreeparser/tests/interfacetest.cpp index fa372a60..923a7446 100644 --- a/framework/domain/mimetreeparser/tests/interfacetest.cpp +++ b/framework/domain/mimetreeparser/tests/interfacetest.cpp | |||
@@ -237,6 +237,8 @@ private slots: | |||
237 | QCOMPARE(contentPart->signatures().size(), 0); | 237 | QCOMPARE(contentPart->signatures().size(), 0); |
238 | auto contentList = contentPart->content("plaintext"); | 238 | auto contentList = contentPart->content("plaintext"); |
239 | QCOMPARE(contentList.size(), 1); | 239 | QCOMPARE(contentList.size(), 1); |
240 | auto contentAttachmentList = parser.collectAttachmentParts(); | ||
241 | QCOMPARE(contentAttachmentList.size(), 0); | ||
240 | } | 242 | } |
241 | }; | 243 | }; |
242 | 244 | ||