[prev in list] [next in list] [prev in thread] [next in thread] 

List:       james-dev
Subject:    [jira] [Commented] (JAMES-3410) Email/set: Destroy email
From:       "ASF GitHub Bot (Jira)" <server-dev () james ! apache ! org>
Date:       2021-02-18 8:31:00
Message-ID: JIRA.13333864.1601970989000.627802.1613637060477 () Atlassian ! JIRA
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/JAMES-3410?page=com.atlassian.jira.plugin. \
system.issuetabpanels:comment-tabpanel&focusedCommentId=17286349#comment-17286349 ] 

ASF GitHub Bot commented on JAMES-3410:
---------------------------------------

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


> Email/set: Destroy email
> ------------------------
> 
> Key: JAMES-3410
> URL: https://issues.apache.org/jira/browse/JAMES-3410
> Project: James Server
> Issue Type: Sub-task
> Components: JMAP
> Reporter: Benoit Tellier
> Assignee: Antoine Duprat
> Priority: Major
> Fix For: 3.6.0
> 
> 
> This is the implementation of the destroy part of Email/set.
> From JMAP specs https://jmap.io/spec-mail.html#emailset :
> > Destroying an Email removes it from all Mailboxes to which it belonged. To just \
> > delete an Email to trash, simply change the mailboxIds property, so it is now in \
> > the Mailbox with a role property equal to trash, and remove all other Mailbox \
> > ids. When emptying the trash, clients SHOULD NOT destroy Emails that are also in \
> > a Mailbox other than trash. For those Emails, they SHOULD just remove the trash \
> > Mailbox from the Email.
> When destroying an email, it removes it from all mailboxes to which it belongs. Any \
>                 other operation is an update of `Mailboxids` and is of no concern \
>                 in this ticket.
> **Example**
> Request:
> {code:java}
> {
> "using": [ "urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail" ],
> "methodCalls": [
> [
> "Email/set",
> {
> "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
> "destroy": ["0001"]
> },
> "c1"]
> ]
> }
> {code}
> Response:
> {code:java}
> {
> "sessionState": "75128aab4b1b",
> "methodResponses": [[
> "Mailbox/set",
> {
> "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
> "newState": "000001",
> "destroyed": ["0001"]
> },
> "c1"]]
> }
> {code}
> **DoD**
> * Write integration tests showing email is getting removed from all Mailboxes it \
> belongs to and deleted from the system when doing an Email/set destroy



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic