From 05bb9d06daf1ce2951698af22640353b27521489 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 11 Mar 2020 21:54:38 +0100 Subject: [PATCH] make API pagination optional --- routers/api/v1/utils/utils.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routers/api/v1/utils/utils.go b/routers/api/v1/utils/utils.go index 092ea3dbb..2c06e8183 100644 --- a/routers/api/v1/utils/utils.go +++ b/routers/api/v1/utils/utils.go @@ -41,8 +41,12 @@ func GetQueryBeforeSince(ctx *context.APIContext) (before, since int64, err erro // GetListOptions returns list options using the page and limit parameters func GetListOptions(ctx *context.APIContext) models.ListOptions { + page := ctx.QueryInt("page") + if page == 0 { + return models.ListOptions{} + } return models.ListOptions{ - Page: ctx.QueryInt("page"), + Page: page, PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")), } }