aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2012-11-10 16:47:55 +0000
committerVincent Richard <[email protected]>2012-11-10 16:47:55 +0000
commitf4c42cc0cff66ff9754c37123daad42806453f69 (patch)
tree4965b39bed014995f425a78c1c6858a6700c6111
parentRemoved unused file. (diff)
downloadvmime-f4c42cc0cff66ff9754c37123daad42806453f69.tar.gz
vmime-f4c42cc0cff66ff9754c37123daad42806453f69.zip
Compatibility with RFC-1341.
-rw-r--r--src/attachmentHelper.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/attachmentHelper.cpp b/src/attachmentHelper.cpp
index c23ee950..01746813 100644
--- a/src/attachmentHelper.cpp
+++ b/src/attachmentHelper.cpp
@@ -74,6 +74,7 @@ bool attachmentHelper::isBodyPartAnAttachment
// Assume "attachment" if type is not "text/..." or "multipart/...".
mediaType type;
+ bool hasContentTypeName = false;
try
{
@@ -81,6 +82,9 @@ bool attachmentHelper::isBodyPartAnAttachment
(*part->getHeader()->findField(fields::CONTENT_TYPE));
type = *ctf.getValue().dynamicCast <const mediaType>();
+
+ if (ctf.hasParameter("name"))
+ hasContentTypeName = true;
}
catch (exceptions::no_such_field&)
{
@@ -98,6 +102,11 @@ bool attachmentHelper::isBodyPartAnAttachment
if (type.getType() != mediaTypes::TEXT &&
type.getType() != mediaTypes::MULTIPART)
{
+ // Compatibility with (obsolete) RFC-1341: if there is a "name" parameter
+ // on the "Content-Type" field, then we assume it is an attachment
+ if (hasContentTypeName)
+ return true;
+
if ((options & INLINE_OBJECTS) == 0)
{
// If a "Content-Id" field is present, it might be an