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


The following commit(s) were added to refs/heads/master by this push:
     new 727637f0d4 JMAP: normalize charset case (#2877)
727637f0d4 is described below

commit 727637f0d4bfe6beae9b67918c450cdffe810c1c
Author: Benoit TELLIER <[email protected]>
AuthorDate: Mon Dec 8 07:29:59 2025 +0100

    JMAP: normalize charset case (#2877)
---
 .../rfc8621/contract/EmailGetMethodContract.scala  | 24 +++++++++++-----------
 .../contract/EmailParseMethodContract.scala        |  6 +++---
 .../org/apache/james/jmap/mail/EmailBodyPart.scala |  2 +-
 3 files changed, 16 insertions(+), 16 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 85c8e7b38f..c060a30b48 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
@@ -2478,7 +2478,7 @@ trait EmailGetMethodContract {
          |                                "size": 398,
          |                                "name": "text2",
          |                                "type": 
"application/vnd.ms-publisher",
-         |                                "charset": "us-ascii",
+         |                                "charset": "US-ASCII",
          |                                "disposition": "attachment"
          |                            },
          |                            {
@@ -3930,7 +3930,7 @@ trait EmailGetMethodContract {
          |                            ],
          |                            "size": 1880,
          |                            "type": "multipart/mixed",
-         |                            "charset": "us-ascii",
+         |                            "charset": "US-ASCII",
          |                            "subParts": [
          |                                {
          |                                    "partId": "2",
@@ -3992,7 +3992,7 @@ trait EmailGetMethodContract {
          |                                    "size": 398,
          |                                    "name": "text2",
          |                                    "type": 
"application/vnd.ms-publisher",
-         |                                    "charset": "us-ascii",
+         |                                    "charset": "US-ASCII",
          |                                    "disposition": "attachment"
          |                                },
          |                                {
@@ -4125,7 +4125,7 @@ trait EmailGetMethodContract {
          |                            ],
          |                            "size": 891,
          |                            "type": "multipart/mixed",
-         |                            "charset": "us-ascii",
+         |                            "charset": "US-ASCII",
          |                            "subParts": [
          |                                {
          |                                    "partId": "2",
@@ -4137,7 +4137,7 @@ trait EmailGetMethodContract {
          |                                    ],
          |                                    "size": 398,
          |                                    "type": "multipart/alternative",
-         |                                    "charset": "us-ascii",
+         |                                    "charset": "US-ASCII",
          |                                    "subParts": [
          |                                        {
          |                                            "partId": "3",
@@ -4680,7 +4680,7 @@ trait EmailGetMethodContract {
          |                        "id": "${messageId.serialize}",
          |                         "attachments": [
          |                            {
-         |                                "charset": "us-ascii",
+         |                                "charset": "US-ASCII",
          |                                "disposition": "attachment",
          |                                "size": 102,
          |                                "partId": "3",
@@ -4689,7 +4689,7 @@ trait EmailGetMethodContract {
          |                                "name":"yyy.txt"
          |                            },
          |                            {
-         |                                "charset": "us-ascii",
+         |                                "charset": "US-ASCII",
          |                                "disposition": "attachment",
          |                                "size": 102,
          |                                "partId": "4",
@@ -4802,7 +4802,7 @@ trait EmailGetMethodContract {
          |                                     "sentAt": 
"$${json-unit.ignore}",
          |                                     "hasAttachment": true,
          |                                     "attachments": [{
-         |                                                     "charset": 
"us-ascii",
+         |                                                     "charset": 
"US-ASCII",
          |                                                     "disposition": 
"attachment",
          |                                                     "size": 102,
          |                                                     "partId": "3",
@@ -4811,7 +4811,7 @@ trait EmailGetMethodContract {
          |                                                     "type": 
"application/json"
          |                                             },
          |                                             {
-         |                                                     "charset": 
"us-ascii",
+         |                                                     "charset": 
"US-ASCII",
          |                                                     "disposition": 
"attachment",
          |                                                     "size": 102,
          |                                                     "partId": "4",
@@ -5034,7 +5034,7 @@ trait EmailGetMethodContract {
          |                                     "sentAt": 
"$${json-unit.ignore}",
          |                                     "hasAttachment": true,
          |                                     "attachments": [{
-         |                                                     "charset": 
"us-ascii",
+         |                                                     "charset": 
"US-ASCII",
          |                                                     "headers": [{
          |                                                                     
"name": "Content-Type",
          |                                                                     
"value": " application/json; charset=us-ascii"
@@ -5056,7 +5056,7 @@ trait EmailGetMethodContract {
          |                                                     "type": 
"application/json"
          |                                             },
          |                                             {
-         |                                                     "charset": 
"us-ascii",
+         |                                                     "charset": 
"US-ASCII",
          |                                                     "headers": [{
          |                                                                     
"name": "Content-Type",
          |                                                                     
"value": " application/json; charset=us-ascii"
@@ -6113,7 +6113,7 @@ trait EmailGetMethodContract {
          |                                "size": 398,
          |                                "name": "text2",
          |                                "type": 
"application/vnd.ms-publisher",
-         |                                "charset": "us-ascii",
+         |                                "charset": "US-ASCII",
          |                                "disposition": "attachment"
          |                            },
          |                            {
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/EmailParseMethodContract.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailParseMethodContract.scala
index 587b5de6a5..d825748c89 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailParseMethodContract.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailParseMethodContract.scala
@@ -129,7 +129,7 @@ trait EmailParseMethodContract {
            |                                "type": "text/plain"
            |                            },
            |                            {
-           |                                "charset": "us-ascii",
+           |                                "charset": "US-ASCII",
            |                                "disposition": "attachment",
            |                                "size": 398,
            |                                "partId": "4",
@@ -615,7 +615,7 @@ trait EmailParseMethodContract {
            |                                "size": 398,
            |                                "name": "text2",
            |                                "type": 
"application/vnd.ms-publisher",
-           |                                "charset": "us-ascii",
+           |                                "charset": "US-ASCII",
            |                                "disposition": "attachment"
            |                            },
            |                            {
@@ -722,7 +722,7 @@ trait EmailParseMethodContract {
            |                                "size": 398,
            |                                "name": "text2",
            |                                "type": 
"application/vnd.ms-publisher",
-           |                                "charset": "us-ascii",
+           |                                "charset": "US-ASCII",
            |                                "disposition": "attachment"
            |                            },
            |                            {
diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/EmailBodyPart.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/EmailBodyPart.scala
index 8546980034..94238ce54c 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/EmailBodyPart.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/EmailBodyPart.scala
@@ -148,7 +148,7 @@ object EmailBodyPart {
           size = size,
           name = Name.of(entity),
           `type` = Type(entity.getMimeType),
-          charset = Option(entity.getCharset).map(Charset),
+          charset = 
Option(entity.getCharset).map(_.toUpperCase(Locale.US)).map(Charset),
           disposition = Option(entity.getDispositionType).map(Disposition(_)),
           cid = ClientCid.of(entity),
           language = Languages.of(entity),


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to