You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2021/02/18 05:55:01 UTC

[GitHub] [james-project] chibenwa opened a new pull request #301: JAMES-3410 Email/set deletes should not delete mails when no delete r…

chibenwa opened a new pull request #301:
URL: https://github.com/apache/james-project/pull/301


   …ight
   
   JMAP draft and JMAP RFC-8621 are both impacted. Not found was returned but
   the not yet validated set was used for deletes.
   
   Credits to Lê Loan (https://github.com/tlle14) for spotting it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] Arsnael commented on a change in pull request #301: JAMES-3410 Email/set deletes should not delete mails when no delete r…

Posted by GitBox <gi...@apache.org>.
Arsnael commented on a change in pull request #301:
URL: https://github.com/apache/james-project/pull/301#discussion_r578221006



##########
File path: server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala
##########
@@ -2457,6 +2457,128 @@ trait EmailSetMethodContract {
            |}]""".stripMargin)
   }
 
+  @Test
+  def textContentTransferEncodingShouldBeRejectedInTextBody(server: GuiceJamesServer): Unit = {
+    val bobPath = MailboxPath.inbox(BOB)
+    val mailboxId = server.getProbe(classOf[MailboxProbeImpl]).createMailbox(bobPath)
+    val textBody: String = "Let me tell you all about it."
+
+    val request =
+      s"""{
+         |  "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
+         |  "methodCalls": [
+         |    ["Email/set", {
+         |      "accountId": "$ACCOUNT_ID",
+         |      "create": {
+         |        "aaaaaa": {
+         |          "mailboxIds": {
+         |             "${mailboxId.serialize}": true
+         |          },
+         |          "subject": "World domination",
+         |          "attachments": [],
+         |          "textBody": [
+         |            {
+         |              "partId": "a49d",
+         |              "type": "text/plain",
+         |              "header:Content-Transfer-Encoding:asText": "gabou"
+         |            }
+         |          ],
+         |          "bodyValues": {
+         |            "a49d": {
+         |              "value": "$textBody",
+         |              "isTruncated": false,
+         |              "isEncodingProblem": false
+         |            }
+         |          }
+         |        }
+         |      }
+         |    }, "c1"]
+         |  ]
+         |}""".stripMargin
+
+    val response = `given`
+      .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
+      .body(request)
+    .when
+      .post.prettyPeek()

Review comment:
       debug spotted

##########
File path: server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala
##########
@@ -2457,6 +2457,128 @@ trait EmailSetMethodContract {
            |}]""".stripMargin)
   }
 
+  @Test
+  def textContentTransferEncodingShouldBeRejectedInTextBody(server: GuiceJamesServer): Unit = {
+    val bobPath = MailboxPath.inbox(BOB)
+    val mailboxId = server.getProbe(classOf[MailboxProbeImpl]).createMailbox(bobPath)
+    val textBody: String = "Let me tell you all about it."
+
+    val request =
+      s"""{
+         |  "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
+         |  "methodCalls": [
+         |    ["Email/set", {
+         |      "accountId": "$ACCOUNT_ID",
+         |      "create": {
+         |        "aaaaaa": {
+         |          "mailboxIds": {
+         |             "${mailboxId.serialize}": true
+         |          },
+         |          "subject": "World domination",
+         |          "attachments": [],
+         |          "textBody": [
+         |            {
+         |              "partId": "a49d",
+         |              "type": "text/plain",
+         |              "header:Content-Transfer-Encoding:asText": "gabou"
+         |            }
+         |          ],
+         |          "bodyValues": {
+         |            "a49d": {
+         |              "value": "$textBody",
+         |              "isTruncated": false,
+         |              "isEncodingProblem": false
+         |            }
+         |          }
+         |        }
+         |      }
+         |    }, "c1"]
+         |  ]
+         |}""".stripMargin
+
+    val response = `given`
+      .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
+      .body(request)
+    .when
+      .post.prettyPeek()
+    .`then`
+      .statusCode(SC_OK)
+      .contentType(JSON)
+      .extract
+      .body
+      .asString
+
+    println(response)
+    assertThatJson(response)
+      .inPath("methodResponses[0][1].notCreated.aaaaaa")
+      .isEqualTo(
+        s"""{
+           |  "type":"invalidArguments",
+           |  "description":"List((/textBody(0),List(JsonValidationError(List(Content-Transfer-Encoding must not be specified in htmlBody or textBody),List()))))"
+           |}""".stripMargin)
+  }
+
+  @Test
+  def binaryContentTransferEncodingShouldBeRejectedInTextBody(server: GuiceJamesServer): Unit = {
+    val bobPath = MailboxPath.inbox(BOB)
+    val mailboxId = server.getProbe(classOf[MailboxProbeImpl]).createMailbox(bobPath)
+    val textBody: String = "Let me tell you all about it."
+
+    val request =
+      s"""{
+         |  "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
+         |  "methodCalls": [
+         |    ["Email/set", {
+         |      "accountId": "$ACCOUNT_ID",
+         |      "create": {
+         |        "aaaaaa": {
+         |          "mailboxIds": {
+         |             "${mailboxId.serialize}": true
+         |          },
+         |          "subject": "World domination",
+         |          "attachments": [],
+         |          "textBody": [
+         |            {
+         |              "partId": "a49d",
+         |              "type": "text/plain",
+         |              "header:Content-Transfer-Encoding": " gabou"
+         |            }
+         |          ],
+         |          "bodyValues": {
+         |            "a49d": {
+         |              "value": "$textBody",
+         |              "isTruncated": false,
+         |              "isEncodingProblem": false
+         |            }
+         |          }
+         |        }
+         |      }
+         |    }, "c1"]
+         |  ]
+         |}""".stripMargin
+
+    val response = `given`
+      .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
+      .body(request)
+    .when
+      .post.prettyPeek()

Review comment:
       debug spotted




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] chibenwa closed pull request #301: JAMES-3410 Email/set deletes should not delete mails when no delete r…

Posted by GitBox <gi...@apache.org>.
chibenwa closed pull request #301:
URL: https://github.com/apache/james-project/pull/301


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] Arsnael commented on pull request #301: JAMES-3410 Email/set deletes should not delete mails when no delete r…

Posted by GitBox <gi...@apache.org>.
Arsnael commented on pull request #301:
URL: https://github.com/apache/james-project/pull/301#issuecomment-781262106


   I believe your last two commits related to issue https://issues.apache.org/jira/browse/JAMES-3499 are a separate matter from JAMES-3410 no? Can you split it into an other PR? 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] Arsnael edited a comment on pull request #301: JAMES-3410 Email/set deletes should not delete mails when no delete r…

Posted by GitBox <gi...@apache.org>.
Arsnael edited a comment on pull request #301:
URL: https://github.com/apache/james-project/pull/301#issuecomment-781262106


   I believe your last two commits related to issue https://issues.apache.org/jira/browse/JAMES-3499 are a separate matter from JAMES-3410 no? Can you split it into an other PR? 
   
   EDIT: which seems to be here: https://github.com/apache/james-project/pull/303
   I'm confused now :)  


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] chibenwa commented on pull request #301: JAMES-3410 Email/set deletes should not delete mails when no delete r…

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #301:
URL: https://github.com/apache/james-project/pull/301#issuecomment-781760146


   > I'm confused now :)
   
   I messed up in my branches, it should be fixed now...


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [james-project] chibenwa commented on pull request #301: JAMES-3410 Email/set deletes should not delete mails when no delete r…

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #301:
URL: https://github.com/apache/james-project/pull/301#issuecomment-782103192


   (reopened to trick the ci)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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