summaryrefslogtreecommitdiffstats
path: root/api4/params.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-21 09:06:08 -0400
committerGitHub <noreply@github.com>2017-03-21 09:06:08 -0400
commitfd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b (patch)
tree708faaa67a39648dcd9deab953d836771f531d8f /api4/params.go
parent4968ef0759087f34c1674a385707f6befef810b7 (diff)
downloadchat-fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b.tar.gz
chat-fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b.tar.bz2
chat-fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b.zip
Implement GET /audits endpoint for APIv4 (#5779)
* Implement GET /audits endpoint for APIv4 * Fix log unit test
Diffstat (limited to 'api4/params.go')
-rw-r--r--api4/params.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/api4/params.go b/api4/params.go
index 15f632195..8bb072742 100644
--- a/api4/params.go
+++ b/api4/params.go
@@ -101,13 +101,13 @@ func ApiParamsFromRequest(r *http.Request) *ApiParams {
params.PreferenceName = val
}
- if val, err := strconv.Atoi(r.URL.Query().Get("page")); err != nil {
+ if val, err := strconv.Atoi(r.URL.Query().Get("page")); err != nil || val < 0 {
params.Page = PAGE_DEFAULT
} else {
params.Page = val
}
- if val, err := strconv.Atoi(r.URL.Query().Get("per_page")); err != nil {
+ if val, err := strconv.Atoi(r.URL.Query().Get("per_page")); err != nil || val < 0 {
params.PerPage = PER_PAGE_DEFAULT
} else if val > PER_PAGE_MAXIMUM {
params.PerPage = PER_PAGE_MAXIMUM