openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgr...@apache.org
Subject [incubator-openwhisk-apigateway] branch master updated: Guard against missing query parameters. (#343)
Date Wed, 29 May 2019 13:54:57 GMT
This is an automated email from the ASF dual-hosted git repository.

dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-apigateway.git


The following commit(s) were added to refs/heads/master by this push:
     new 4071f82  Guard against missing query parameters. (#343)
4071f82 is described below

commit 4071f82cf0a6adaafae206a1d197f0a636e8671c
Author: rodric rabbah <rodric@gmail.com>
AuthorDate: Wed May 29 09:54:52 2019 -0400

    Guard against missing query parameters. (#343)
---
 scripts/lua/management/lib/tenants.lua | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/lua/management/lib/tenants.lua b/scripts/lua/management/lib/tenants.lua
index 314da92..a83c773 100644
--- a/scripts/lua/management/lib/tenants.lua
+++ b/scripts/lua/management/lib/tenants.lua
@@ -114,7 +114,7 @@ function _M.getTenantAPIs(dataStore, id, queryParams)
       end
     end
   end
-  if ((queryParams['skip']  == nil and queryParams['limit'] == nil) or table.getn(apiList)
== 0) then
+  if (((queryParams['skip'] == nil or queryParams['skip'] == 'undefined') and (queryParams['limit']
== nil or queryParams['limit'] == 'undefined')) or table.getn(apiList) == 0) then
     return apiList
   else
     return applyPagingToAPIs(apiList, queryParams)
@@ -127,10 +127,14 @@ end
 function applyPagingToAPIs(apiList, queryParams)
   local skip  = queryParams['skip']  == nil and 1 or queryParams['skip']
   local limit = queryParams['limit'] == nil and table.getn(apiList) or queryParams['limit']
-  if (tonumber(limit) < 1) then
+
+  skip = tonumber(skip)
+  limit = tonumber(limit)
+
+  if (limit == nil or limit < 1) then
     return {}
   end
-  if (tonumber(skip) <= 0) then
+  if (skip == nil or skip <= 0) then
     skip = 1
   else
     skip = skip + 1


Mime
View raw message