You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2017/12/15 10:07:10 UTC

[1/3] james-project git commit: JAMES-2258 inline should be false in case of no Content-ID for inlined attachment

Repository: james-project
Updated Branches:
  refs/heads/master 9d3bbbd31 -> af726bbb9


JAMES-2258 inline should be false in case of no Content-ID for inlined attachment


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

Branch: refs/heads/master
Commit: e456bf7e000c9f5dc05bfc4d1f689d0f34c5c06f
Parents: 8e9c667
Author: quynhn <qn...@linagora.com>
Authored: Wed Dec 13 17:51:31 2017 +0700
Committer: quynhn <qn...@linagora.com>
Committed: Wed Dec 13 17:51:31 2017 +0700

----------------------------------------------------------------------
 .../james/mailbox/store/mail/model/impl/MessageParser.java   | 2 +-
 .../src/test/resources/cucumber/GetMessages.feature          | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/e456bf7e/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java
index d447b20..3331b7b 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/MessageParser.java
@@ -130,7 +130,7 @@ public class MessageParser {
         Optional<String> contentType = contentType(contentTypeField);
         Optional<String> name = name(contentTypeField, contentDispositionField);
         Optional<Cid> cid = cid(readHeader(entity, CONTENT_ID, ContentIdField.class));
-        boolean isInline = isInline(readHeader(entity, CONTENT_DISPOSITION, ContentDispositionField.class));
+        boolean isInline = isInline(readHeader(entity, CONTENT_DISPOSITION, ContentDispositionField.class)) && cid.isPresent();
 
         return MessageAttachment.builder()
                 .attachment(Attachment.builder()

http://git-wip-us.apache.org/repos/asf/james-project/blob/e456bf7e/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
index 11dde7a..9d79b44 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
@@ -276,9 +276,9 @@ Feature: GetMessages method
     And the list of attachments of the message contains 1 attachments
     And the first attachment is:
       |key      | value                                     |
-      |type     |"application/pdf"                               |
+      |type     |"application/pdf"                          |
       |cid      |null                                       |
-      |isInline |true                                      |
+      |isInline |false                                      |
 
   Scenario: Retrieving message with inline attachment and blank CID should convert that inlined attachment to normal attachment
     Given "alice@domain.tld" has a message "m1" in "INBOX" mailbox with inline attachment and blank CID
@@ -291,7 +291,7 @@ Feature: GetMessages method
         |key      | value            |
         |type     |"application/pdf" |
         |cid      |null              |
-        |isInline |true              |
+        |isInline |false             |
 
   Scenario: Preview should be computed even when HTML body contains many tags without content
     Given "alice@domain.tld" has a message "m1" in "INBOX" mailbox with HTML body with many empty tags
@@ -407,4 +407,4 @@ Feature: GetMessages method
       |type     |"application/octet-stream"    |
       |cid      |null                          |
       |name     |"encrypted.asc"               |
-      |isInline |true                          |
+      |isInline |false                         |


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


[3/3] james-project git commit: Merge remote-tracking branch 'quynhn/JAMES-2258'

Posted by ad...@apache.org.
Merge remote-tracking branch 'quynhn/JAMES-2258'


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

Branch: refs/heads/master
Commit: af726bbb996dec5b7260a858dd8dab4be4878306
Parents: 9d3bbbd 0028797
Author: Antoine Duprat <ad...@linagora.com>
Authored: Fri Dec 15 11:06:45 2017 +0100
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Fri Dec 15 11:06:45 2017 +0100

----------------------------------------------------------------------
 .../store/mail/model/impl/MessageParser.java    |  2 +-
 .../cucumber/GetMessagesMethodStepdefs.java     |  7 ++-
 .../test/resources/cucumber/GetMessages.feature | 22 +++++--
 .../resources/eml/inlinedWithoutContentID.eml   | 60 ++++++++++++++++++++
 4 files changed, 85 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



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


[2/3] james-project git commit: JAMES-2258 Inlined attachment should consider as false when no Content-ID

Posted by ad...@apache.org.
JAMES-2258 Inlined attachment should consider as false when no Content-ID


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

Branch: refs/heads/master
Commit: 0028797d9362e2d334d706c90a89ea2425427909
Parents: e456bf7
Author: quynhn <qn...@linagora.com>
Authored: Fri Dec 15 10:04:48 2017 +0700
Committer: quynhn <qn...@linagora.com>
Committed: Fri Dec 15 10:04:48 2017 +0700

----------------------------------------------------------------------
 .../cucumber/GetMessagesMethodStepdefs.java     |  7 ++-
 .../test/resources/cucumber/GetMessages.feature | 14 +++++
 .../resources/eml/inlinedWithoutContentID.eml   | 60 ++++++++++++++++++++
 3 files changed, 80 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/0028797d/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
index 0e51707..755b3ff 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
@@ -329,10 +329,15 @@ public class GetMessagesMethodStepdefs {
     }
 
     @Given("^\"([^\"]*)\" has a message \"([^\"]*)\" in the \"([^\"]*)\" mailbox with inlined attachments without content disposition$")
-    public void test(String username, String messageName, String mailbox) throws Exception {
+    public void appendMessageWithInlinedImageButNoContentDisposition(String username, String messageName, String mailbox) throws Exception {
         userStepdefs.execWithUser(username, () -> appendMessage(messageName, mailbox, "eml/inlinedWithoutContentDisposition.eml"));
     }
 
+    @Given("^\"([^\"]*)\" has a message \"([^\"]*)\" in the \"([^\"]*)\" mailbox with inlined image without content ID$")
+    public void appendMessageWithInlinedImageButNoContentID(String username, String messageName, String mailbox) throws Exception {
+        userStepdefs.execWithUser(username, () -> appendMessage(messageName, mailbox, "eml/inlinedWithoutContentID.eml"));
+    }
+
     @Given("^\"([^\"]*)\" has a message \"([^\"]*)\" in \"([^\"]*)\" mailbox with specific charset$")
     public void appendMessageWithSpecificCharset(String username, String messageName, String mailbox) throws Throwable {
         userStepdefs.execWithUser(username, () -> appendMessageWithSpecificCharset(messageName, mailbox));

http://git-wip-us.apache.org/repos/asf/james-project/blob/0028797d/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
index 9d79b44..cb4c951 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
@@ -408,3 +408,17 @@ Feature: GetMessages method
       |cid      |null                          |
       |name     |"encrypted.asc"               |
       |isInline |false                         |
+
+  Scenario: Retrieving message should be possible when message with inlined attachment but without content ID
+    Given "alice@domain.tld" has a message "m1" in the "INBOX" mailbox with inlined image without content ID
+    When "alice@domain.tld" ask for messages "m1"
+    Then no error is returned
+    And the list should contain 1 message
+    And the hasAttachment of the message is "true"
+    And the list of attachments of the message contains 1 attachments
+    And the first attachment is:
+    |key      | value                        |
+    |type     |"image/jpeg"                  |
+    |cid      |null                          |
+    |name     |"IMG_6112.JPG"                |
+    |isInline |false                         |

http://git-wip-us.apache.org/repos/asf/james-project/blob/0028797d/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/inlinedWithoutContentID.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/inlinedWithoutContentID.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/inlinedWithoutContentID.eml
new file mode 100644
index 0000000..6ea2375
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/inlinedWithoutContentID.eml
@@ -0,0 +1,60 @@
+Return-Path: <us...@localhost.com>
+Received: from localhost
+X-Sieve: CMU Sieve 2.4
+X-Virus-Scanned: Debian amavisd-new at localhost.com
+X-Spam-Flag: NO
+X-Spam-Score: -1.289
+X-Spam-Level:
+Content-Type: multipart/mixed; boundary=Apple-Mail-E1D6D861-D1AD-47F9-A403-F2AA32CC52CC
+Content-Transfer-Encoding: 7bit
+From: Sender <fr...@localhost.com>
+Mime-Version: 1.0 (1.0)
+Date: Mon, 11 Dec 2017 22:06:42 +0100
+Subject: Inlined Photos
+Message-Id: <se...@localhost.com>
+X-Mailer: iPhone Mail (14G60)
+
+
+--Apple-Mail-E1D6D861-D1AD-47F9-A403-F2AA32CC52CC
+Content-Type: text/plain;
+	charset=us-ascii
+Content-Transfer-Encoding: 7bit
+
+
+
+
+--Apple-Mail-E1D6D861-D1AD-47F9-A403-F2AA32CC52CC
+Content-Type: image/jpeg;
+	name=IMG_6112.JPG;
+	x-apple-part-url=B11616AF-86EB-47AF-863A-176A823498DB
+Content-Disposition: inline;
+	filename=IMG_6112.JPG
+Content-Transfer-Encoding: base64
+
+/9j/4QZIRXhpZgAATU0AKgAAAAgACgEPAAIAAAAGAAAAhgEQAAIAAAAJAAAAjAESAAMAAAABAAYA
+AAEaAAUAAAABAAAAlgEbAAUAAAABAAAAngEoAAMAAAABAAIAAAExAAIAAAAHAAAApgEyAAIAAAAU
+AAAArgITAAMAAAABAAEAAIdpAAQAAAABAAAAwgAAAABBcHBsZQBpUGhvbmUgNgAAAAAASAAAAAEA
+AABIAAAAATEwLjMuMwAAMjAxNzoxMjoxMSAxODowNjoyMAAAIIKaAAUAAAABAAACSIKdAAUAAAAB
+AAACUIgiAAMAAAABAAIAAIgnAAMAAAABAPoAAJAAAAcAAAAEMDIyMZADAAIAAAAUAAACWJAEAAIA
+AAAUAAACbJEBAAcAAAAEAQIDAJIBAAoAAAABAAACgJICAAUAAAABAAACiJIDAAoAAAABAAACkJIE
+AAoAAAABAAACmJIHAAMAAAABAAUAAJIJAAMAAAABABgAAJIKAAUAAAABAAACoJIUAAMAAAAEAAAC
+qJJ8AAcAAANGAAACsJKRAAIAAAAEOTExAJKSAAIAAAAEOTExAKAAAAcAAAAEMDEwMKABAAMAAAAB
+AAEAAKACAAQAAAABAAAMwKADAAQAAAABAAAJkKIXAAMAAAABAAIAAKMBAAcAAAABAQAAAKQCAAMA
+AAABAAAAAKQDAAMAAAABAAAAAKQFAAMAAAABAB0AAKQGAAMAAAABAAAAAKQyAAUAAAAEAAAF9qQz
+AAIAAAAGAAAGFqQ0AAIAAAAiAAAGHAAAAAAAAAABAAAAIQAAAAsAAAAFMjAxNzoxMjoxMSAxODow
+NjoyMAAyMDE3OjEyOjExIDE4OjA2OjIwAAAAAP0AAAAyAAAe1AAADY0AABEhAAAItAAAAAAAAAAB
+AAAAUwAAABQGXwTHBwMENUFwcGxlIGlPUwAAAU1NAAsAAQAJAAAAAQAAAAUAAgAHAAACLgAAAJgA
+AwAHAAAAaAAAAsYABAAJAAAAAQAAAAEABQAJAAAAAQAAAO8ABgAJAAAAAQAAAQIABwAJAAAAAQAA
+AAEACAAKAAAAAwAAAy4ACQAJAAAAAQAAARMADgAJAAAAAQAAAAAAFAAJAAAAAQAAAAQAAAAAYnBs
+aXN0MDBPEQIAXABhAG8AHwFaAUUBOAEfAQUB/gCJAZUBnQGxAcEByAFgAJUAVgFcATEBKAE/AVgB
+dwFtAXsBqgGsAbABtAG8AXwAUwEdAe0A5gCyAIAAbACQAOwAdwGuAcUBrQGlAbMBFwE5ARwB6gCf
+ABIAEwATAA8AJQBrADwBqwHAAawBpAFrAVwBVAHzAD8AHAAhABYAEgARACQAyAD3AJkBrAGdARkB
+JwELAQYBMAAYACkAGAAaACMADwB7ANoANQGvAZUBYgEkAUgBWQF3ABMANABWALkAKgH1ANQA7gAy
+VNRXU//Z
+--Apple-Mail-E1D6D861-D1AD-47F9-A403-F2AA32CC52CC
+Content-Type: text/plain;
+	charset=us-ascii
+Content-Transfer-Encoding: 7bit
+--
+Sender
+--Apple-Mail-E1D6D861-D1AD-47F9-A403-F2AA32CC52CC--
\ No newline at end of file


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