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:48 UTC

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

Updated Branches:
  refs/heads/camel-2.11.x 83e0e5ca9 -> 3d93c7fb3
  refs/heads/camel-2.12.x 2831c270c -> 87001effc
  refs/heads/master e4f90c068 -> 8b235e006


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/8b235e00
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8b235e00
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8b235e00

Branch: refs/heads/master
Commit: 8b235e006da8435c2a9f90b95bbedcdae1786cad
Parents: e4f90c0
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:37:59 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/8b235e00/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}
      */


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

Posted by da...@apache.org.
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}
      */


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

Posted by da...@apache.org.
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/3d93c7fb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3d93c7fb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3d93c7fb

Branch: refs/heads/camel-2.11.x
Commit: 3d93c7fb36addeee9a5bd16f01a76d31b00743f2
Parents: 83e0e5c
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:25 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/3d93c7fb/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 e1efc45..806c771 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}
      */