This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 7d948857608db296efb457e1b8631297101bc7fd Author: Benoit Tellier <[email protected]> AuthorDate: Fri Oct 23 09:57:08 2020 +0700 JAMES-3412 Keywords are case insentive, lower cased --- .../jmap/rfc8621/contract/EmailGetMethodContract.scala | 16 ++++++++-------- .../jmap/rfc8621/contract/EmailSetMethodContract.scala | 18 +++++++++--------- .../scala/org/apache/james/jmap/model/Keyword.scala | 18 ++++++++++-------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala index 0821e63..a6ca953 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala +++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala @@ -5475,7 +5475,7 @@ trait EmailGetMethodContract { | { | "id":"%s", | "keywords": { - | "$Answered": true + | "$answered": true | } | } """.stripMargin, messageId.serialize) @@ -5530,10 +5530,10 @@ trait EmailGetMethodContract { | { | "id":"%s", | "keywords": { - | "$Answered": true, - | "$Seen": true, - | "$Draft": true, - | "$Flagged": true + | "$answered": true, + | "$seen": true, + | "$draft": true, + | "$flagged": true | } | } """.stripMargin, messageId.serialize) @@ -5588,10 +5588,10 @@ trait EmailGetMethodContract { | { | "id":"%s", | "keywords": { - | "$Answered": true, + | "$answered": true, | "custom_flag": true, - | "$Draft": true, - | "$Flagged": true + | "$draft": true, + | "$flagged": true | } | } """.stripMargin, messageId.serialize) diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala index 4029127..2898b92 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala +++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala @@ -662,7 +662,7 @@ trait EmailSetMethodContract { """{ | "id":"%s", | "keywords": { - | "$Answered": true, + | "$answered": true, | "music": true | } |} @@ -746,28 +746,28 @@ trait EmailSetMethodContract { |{ | "id":"%s", | "keywords": { - | "$Answered": true, + | "$answered": true, | "music": true | } |}, |{ | "id":"%s", | "keywords": { - | "$Answered": true, + | "$answered": true, | "music": true | } |}, |{ | "id":"%s", | "keywords": { - | "$Answered": true, + | "$answered": true, | "music": true | } |}, |{ | "id":"%s", | "keywords": { - | "$Answered": true, + | "$answered": true, | "music": true | } |} @@ -853,25 +853,25 @@ trait EmailSetMethodContract { |{ | "id":"%s", | "keywords": { - | "$Answered": true + | "$answered": true | } |}, |{ | "id":"%s", | "keywords": { - | "$Answered": true + | "$answered": true | } |}, |{ | "id":"%s", | "keywords": { - | "$Answered": true + | "$answered": true | } |}, |{ | "id":"%s", | "keywords": { - | "$Answered": true + | "$answered": true | } |} |] diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Keyword.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Keyword.scala index 704caeb..f63a424 100644 --- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Keyword.scala +++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Keyword.scala @@ -18,6 +18,8 @@ * **************************************************************/ package org.apache.james.jmap.model +import java.util.Locale + import com.ibm.icu.text.UnicodeSet import javax.mail.Flags import org.apache.commons.lang3.StringUtils @@ -32,13 +34,13 @@ object Keyword { " or {'(' ')' '{' ']' '%' '*' '\"' '\\'} " private val FLAG_NAME_PATTERN = new UnicodeSet("[[a-z][A-Z][0-9]$_-]").freeze - val DRAFT = Keyword.of("$Draft").get - val SEEN = Keyword.of("$Seen").get - val FLAGGED = Keyword.of("$Flagged").get - val ANSWERED = Keyword.of("$Answered").get - val DELETED = Keyword.of("$Deleted").get - val RECENT = Keyword.of("$Recent").get - val FORWARDED = Keyword.of("$Forwarded").get + val DRAFT = Keyword.of("$draft").get + val SEEN = Keyword.of("$seen").get + val FLAGGED = Keyword.of("$flagged").get + val ANSWERED = Keyword.of("$answered").get + val DELETED = Keyword.of("$deleted").get + val RECENT = Keyword.of("$recent").get + val FORWARDED = Keyword.of("$forwarded").get val FLAG_VALUE: Boolean = true private val NON_EXPOSED_IMAP_KEYWORDS = List(Keyword.RECENT, Keyword.DELETED) private val IMAP_SYSTEM_FLAGS: Map[Flags.Flag, Keyword] = @@ -50,7 +52,7 @@ object Keyword { Flags.Flag.RECENT -> RECENT, Flags.Flag.DELETED -> DELETED) - def parse(flagName: String): Either[String, Keyword] = Either.cond(isValid(flagName), Keyword(flagName), VALIDATION_MESSAGE) + def parse(flagName: String): Either[String, Keyword] = Either.cond(isValid(flagName), Keyword(flagName.toLowerCase(Locale.US)), VALIDATION_MESSAGE) def of(flagName: String): Try[Keyword] = parse(flagName) match { case Left(errorMessage: String) => Failure(new IllegalArgumentException(errorMessage)) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
