diff options
author | Vincent Richard <[email protected]> | 2006-12-14 21:38:04 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2006-12-14 21:38:04 +0000 |
commit | 3263ad2760fa0b6f65eb669ecd2f986d977ba4f1 (patch) | |
tree | f9704f880651785961ca51266194970666752256 | |
parent | Fixed invalid reuse of cert with gnutls_x509_crt_import (thanks to Benjamin B... (diff) | |
download | vmime-3263ad2760fa0b6f65eb669ecd2f986d977ba4f1.tar.gz vmime-3263ad2760fa0b6f65eb669ecd2f986d977ba4f1.zip |
Fixed attachment detection with non-MIME message (thanks to Peter Libic).
-rw-r--r-- | src/attachmentHelper.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/attachmentHelper.cpp b/src/attachmentHelper.cpp index da95513c..4f685cec 100644 --- a/src/attachmentHelper.cpp +++ b/src/attachmentHelper.cpp @@ -72,6 +72,12 @@ const bool attachmentHelper::isBodyPartAnAttachment(ref <const bodyPart> part) } catch (exceptions::no_such_field&) { + // If this is the root part and no Content-Type field is present, + // then this may not be a MIME message, so do not assume it is + // an attachment + if (part->getParentPart() == NULL) + return false; + // No "Content-type" field: assume "application/octet-stream". type = mediaType(mediaTypes::APPLICATION, mediaTypes::APPLICATION_OCTET_STREAM); @@ -157,7 +163,7 @@ const std::vector <ref <const attachment> > std::vector <ref <const attachment> > partAtts = findAttachmentsInBodyPart(bdy->getPartAt(i)); - std::copy(partAtts.begin(), partAtts.end(), std::back_inserter(atts)); + std::copy(partAtts.begin(), partAtts.end(), std::back_inserter(atts)); } } |