diff OrthancServer/OrthancRestApi/OrthancRestChanges.cpp @ 3560:28ab86c6730e

"/changes": Allow the "limit" argument to be greater than 100
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 07 Nov 2019 07:20:42 +0100
parents 4e43e67f8ecf
children 94f4a18a79cc
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestChanges.cpp	Tue Nov 05 08:10:12 2019 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestChanges.cpp	Thu Nov 07 07:20:42 2019 +0100
@@ -45,7 +45,7 @@
                                bool& last,
                                const RestApiGetCall& call)
   {
-    static const unsigned int MAX_RESULTS = 100;
+    static const unsigned int DEFAULT_LIMIT = 100;
     
     if (call.HasArgument("last"))
     {
@@ -58,17 +58,14 @@
     try
     {
       since = boost::lexical_cast<int64_t>(call.GetArgument("since", "0"));
-      limit = boost::lexical_cast<unsigned int>(call.GetArgument("limit", "0"));
+      limit = boost::lexical_cast<unsigned int>(call.GetArgument("limit", boost::lexical_cast<std::string>(DEFAULT_LIMIT)));
     }
     catch (boost::bad_lexical_cast&)
     {
+      since = 0;
+      limit = DEFAULT_LIMIT;
       return;
     }
-
-    if (limit == 0 || limit > MAX_RESULTS)
-    {
-      limit = MAX_RESULTS;
-    }
   }
 
   static void GetChanges(RestApiGetCall& call)