changeset 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 fb759c9efd73
children bdafff1ce443
files NEWS OrthancServer/OrthancRestApi/OrthancRestChanges.cpp
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Nov 05 08:10:12 2019 +0100
+++ b/NEWS	Thu Nov 07 07:20:42 2019 +0100
@@ -1,6 +1,8 @@
 Pending changes in the mainline
 ===============================
 
+* "/changes": Allow the "limit" argument to be greater than 100
+
 
 Version 1.5.8 (2019-10-16)
 ==========================
--- 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)