summaryrefslogtreecommitdiff
path: root/internal/api/client/admin/reportsget.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-03-03 14:01:11 +0100
committerLibravatar GitHub <noreply@github.com>2023-03-03 14:01:11 +0100
commit88eefd0aeb87888628e215ee81ae588625af5f35 (patch)
treea732d25cc4d0cbdb479ebea482a7c725a486a080 /internal/api/client/admin/reportsget.go
parent[bugfix] Fix unpinning statuses not working (#1582) (diff)
downloadgotosocial-88eefd0aeb87888628e215ee81ae588625af5f35.tar.xz
[bugfix] Clamp admin report limit <1 to 100 (#1583)
* [bugfix] Clamp report limit <1 to 100 * add + update tests
Diffstat (limited to 'internal/api/client/admin/reportsget.go')
-rw-r--r--internal/api/client/admin/reportsget.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/internal/api/client/admin/reportsget.go b/internal/api/client/admin/reportsget.go
index b41877b84..58a8d3163 100644
--- a/internal/api/client/admin/reportsget.go
+++ b/internal/api/client/admin/reportsget.go
@@ -97,8 +97,7 @@ import (
// type: integer
// description: >-
// Number of reports to return.
-// If less than 1, will be clamped to 1.
-// If more than 100, will be clamped to 100.
+// If more than 100 or less than 1, will be clamped to 100.
// default: 20
// in: query
//
@@ -163,9 +162,7 @@ func (m *Module) ReportsGETHandler(c *gin.Context) {
}
// normalize
- if i <= 0 {
- i = 1
- } else if i >= 100 {
+ if i < 1 || i > 100 {
i = 100
}
limit = i