You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/10/01 10:38:49 UTC

[2/3] git commit: CAMEL-6654: Attachments with null filename should not be allowed. Thanks to Christian Posta for the patch.

CAMEL-6654: Attachments with null filename should not be allowed. Thanks to Christian Posta for the patch.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/87001eff
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/87001eff
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/87001eff

Branch: refs/heads/camel-2.12.x
Commit: 87001effc63433b5304397f92442b84afdbe3704
Parents: 2831c27
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Oct 1 10:37:59 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Oct 1 10:38:13 2013 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/mail/MailBinding.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/87001eff/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
index 7fcfb21..e93c49e 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
@@ -321,7 +321,7 @@ public class MailBinding {
                     LOG.trace("Part #{}: LineCount: {}", i, part.getLineCount());
                 }
 
-                if ((disposition != null && (disposition.equalsIgnoreCase(Part.ATTACHMENT) || disposition.equalsIgnoreCase(Part.INLINE)))
+                if (validDisposition(disposition, fileName)
                         || fileName != null) {
                     LOG.debug("Mail contains file attachment: {}", fileName);
                     if (!map.containsKey(fileName)) {
@@ -335,6 +335,12 @@ public class MailBinding {
         }
     }
 
+    private boolean validDisposition(String disposition, String fileName) {
+        return disposition != null
+                && fileName != null
+                && (disposition.equalsIgnoreCase(Part.ATTACHMENT) || disposition.equalsIgnoreCase(Part.INLINE));
+    }
+
     /**
      * Appends the Mail headers from the Camel {@link MailMessage}
      */