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 ce952dfcf7 JAMES-3376 Allow configuring Email/query default limit
ce952dfcf7 is described below

commit ce952dfcf785afd3147b8f9ba87aaa6f2f9efd1f
Author: Benoit TELLIER <[email protected]>
AuthorDate: Mon Nov 24 10:56:35 2025 +0100

    JAMES-3376 Allow configuring Email/query default limit
---
 .../src/main/scala/org/apache/james/jmap/core/Query.scala        | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Query.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Query.scala
index 78fc360523..4336be74e6 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Query.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Query.scala
@@ -47,7 +47,14 @@ case class LimitUnparsed(value: Int) extends AnyVal
 
 object Limit {
   type Limit = Int Refined Positive
-  val default: Limit = 256
+  private val defaultWhenNoneConfigured: Limit = 256
+  val default: Limit = 
Option(System.getProperty("james.jmap.email.query.limit.default"))
+    .map(s => s.toInt)
+    .flatMap(s => {
+      val refinedValue: Either[String, Limit] = refineV(s);
+      refinedValue.toOption
+    })
+    .getOrElse(defaultWhenNoneConfigured)
 
   def validateRequestLimit(requestLimit: Option[LimitUnparsed]): 
Either[IllegalArgumentException, Limit] = {
     val refinedLimit : Option[Either[String, Limit]] =  requestLimit.map(limit 
=> refineV[Positive](limit.value))


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

Reply via email to