james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [7/7] james-project git commit: MAILBOX-290 Error handling for Attachment parser, not throw when unknown content-disposition
Date Tue, 14 Mar 2017 09:01:47 GMT
MAILBOX-290 Error handling for Attachment parser, not throw when unknown content-disposition


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/be7d02c4
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/be7d02c4
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/be7d02c4

Branch: refs/heads/master
Commit: be7d02c49227184f48748225889776bd4b63494a
Parents: fb0c965
Author: Quynh Nguyen <qnguyen@linagora.com>
Authored: Mon Mar 13 10:36:59 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Tue Mar 14 16:00:52 2017 +0700

----------------------------------------------------------------------
 .../mail/model/impl/MessageParserTest.java      |  7 ++
 ...ttachmentsWithOneWrongContentDisposition.eml | 73 ++++++++++++++++++++
 2 files changed, 80 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/be7d02c4/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java
index 7e7d3a5..0ac16f8 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java
@@ -205,4 +205,11 @@ public class MessageParserTest {
 
         assertThat(attachments).hasSize(1);
     }
+
+    @Test
+    public void getAttachmentsShouldRetrieveAttachmentsWhenOneFailOnWrongContentDisposition()
throws Exception {
+        List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/multiAttachmentsWithOneWrongContentDisposition.eml"));
+
+        assertThat(attachments).hasSize(2);
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/be7d02c4/mailbox/store/src/test/resources/eml/multiAttachmentsWithOneWrongContentDisposition.eml
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/resources/eml/multiAttachmentsWithOneWrongContentDisposition.eml
b/mailbox/store/src/test/resources/eml/multiAttachmentsWithOneWrongContentDisposition.eml
new file mode 100644
index 0000000..185d797
--- /dev/null
+++ b/mailbox/store/src/test/resources/eml/multiAttachmentsWithOneWrongContentDisposition.eml
@@ -0,0 +1,73 @@
+Return-Path: <from@linagora.com>
+Received: from alderaan.linagora.com (smtp.linagora.dc1 [172.16.18.53])
+	 by imap (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA;
+	 Mon, 27 Feb 2017 05:24:55 +0100
+X-Sieve: CMU Sieve 2.2
+Received: from [192.168.12.138] (unknown [1.55.245.4])
+	(using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
+	(No client certificate requested)
+	by alderaan.linagora.com (Postfix) with ESMTPSA id 688BF7A9
+	for <from@linagora.com>; Mon, 27 Feb 2017 05:24:54 +0100 (CET)
+To: to@linagora.com
+From: Lina <from@linagora.com>
+Subject: MultiAttachment
+Message-ID: <13d4375e-a4a9-f613-06a1-7e8cb1e0ea93@linagora.com>
+Date: Mon, 27 Feb 2017 11:24:48 +0700
+User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
+ Thunderbird/45.2.0
+MIME-Version: 1.0
+Content-Type: multipart/mixed;
+ boundary="------------64D8D789FC30153D6ED18258"
+
+This is a multi-part message in MIME format.
+--------------64D8D789FC30153D6ED18258
+Content-Type: text/plain; charset=utf-8; format=flowed
+Content-Transfer-Encoding: 7bit
+
+Send
+
+
+--------------64D8D789FC30153D6ED18258
+Content-Type: text/plain; charset=UTF-8;
+ name="text1"
+Content-Transfer-Encoding: base64
+Content-Disposition: wrongDisposition;
+ filename="text1"
+
+LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb2dJQkFBS0NBUUVBeDdQRzAr
+RS8vRU1wbTdJZ0k1UTlUTURTRnlhLzFoRSt2dlRKcmswaUdGbGxQZUhMCkE1L1ZsVE0wWVdn
+RzZYNTBxaU1mRTNWTGF6ZjJjMTlpWHJUMG1xLzIxUFoxd0Zub2d2NHp4VU5haWgrQm5nNjIK
+RjBTeXJ1RS9PL05qcXhoL0NjcTZLL2UwNVRWNFQ2NDNVU3hBZUcwS3BwbVlXOXg4SEEvR3ZW
+ODMyYXBadXhrVgppNk5Wa0RCcmZ6YVVDd3U0ekgrSHdPdi9wSTg3RTdLY2NIWUMrK0JpYWoz
+Cg==
+--------------64D8D789FC30153D6ED18258
+Content-Type: application/vnd.ms-publisher;
+ name="text2"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="text2"
+
+c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFESHM4YlQ0VC84UXltYnNp
+QWpsRDFNd05JWEpyL1dFVDYrOU1tdVRTSVlXV1U5NGNzRG45V1ZNelJoYUFicGZuU3FJeDhU
+ZFV0ck4vWnpYMkpldFBTYXIvYlU5blhBV2VpQy9qUEZRMXFLSDRHZURyWVhSTEt1NFQ4Nzgy
+T3JHSDhKeXJvcjk3VGxOWGhQcmpkUkxFQjRiUXFtbVpoYjNId2NEOGE5WHpmWnFsbTdHUldM
+bzFXUU1HdC9OcFFMQzdqTWY0ZkE2LytranpzVHNweHdkZ0w3NEdKcVBmT1hPaXdnTEhYOENa
+Ni81UnlUcWhUNnBEM01rdFNOV2F6L3pJSFBORXFmNUJZOUNCTTFURlI1dys2TURIbzBnbWlJ
+c1hGRUpUUG5maEJ2SERoU2pCMVJJMEt4VUNseVlySjRmQmxVVmVLZm5hd29WY3U3WXZDcUY0
+RjUgcXV5bmhubkBsaW5hZ29yYQo=
+--------------64D8D789FC30153D6ED18258
+Content-Type: text/plain; charset=UTF-8;
+ name="text3"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="text3"
+
+fDF8b1M3NU9nTDN2RjJHZGw5OUNKRGJFcGFKM3lFPXxJTkdxbGpDVzFYTWY0Z2dPUW0yNi9C
+Tm5LR2M9IHNzaC1yc2EgQUFBQUIzTnphQzF5YzJFQUFBQUJJd0FBQVFFQXEyQTdoUkdtZG5t
+OXRVRGJPOUlEU3dCSzZUYlFhK1BYWVBDUHk2cmJUclR0dzdQSGtjY0tycHAweVZocDVIZEVJ
+Y0tyNnBMbFZEQmZPTFg5UVVzeUNPVjB3emZqSUpObEdFWXNkbExKaXpIaGJuMm1VanZTQUhR
+cVpFVFlQODFlRnpMUU5uUEh0NEVWVlVoN1ZmREVTVTg0S2V6bUQ1UWxXcFhMbXZVMzEveU1m
+K1NlOHhoSFR2S1NDWklGSW1Xd29HNm1iVW9XZjluenBJb2FTakIrd2VxcVVVbXBhYWFzWFZh
+bDcySitVWDJCKzJSUFczUmNUMGVPelFncWxKTDNSS3JUSnZkc2pFM0pFQXZHcTNsR0hTWlh5
+TjZtNVU0aHBwaDl1T3Y1NGFIYzRYcjhqaEFhL1NYNU1KCg==
+--------------64D8D789FC30153D6ED18258--


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message