Skip to content
Snippets Groups Projects
Unverified Commit c84db3b5 authored by Bram Hagens's avatar Bram Hagens
Browse files

Set maxLimit as default value for limit param

parent 4dd6ce3f
No related branches found
Tags v1.4.0
No related merge requests found
......@@ -50,10 +50,15 @@ func ListObjects(w http.ResponseWriter, r *http.Request) {
// Determine offset, limit and filter params
query := r.URL.Query()
var limit int
l := query.Get("limit")
limit, err := strconv.Atoi(l)
if err != nil || limit < 0 {
panic(apierrors.InvalidOffsetOrLimit)
if l == "" {
limit = maxLimit
} else {
limit, err := strconv.Atoi(l)
if err != nil || limit < 0 {
panic(apierrors.InvalidOffsetOrLimit)
}
}
if limit > maxLimit {
panic(apierrors.LimitTooLarge)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment