diff --git a/cmd/internal/api/versions.go b/cmd/internal/api/versions.go index 28d1bd1e92..7577c91cab 100644 --- a/cmd/internal/api/versions.go +++ b/cmd/internal/api/versions.go @@ -547,11 +547,14 @@ func GetRequestOptions(r *http.Request) (v2.RequestOptions, error) { } count := r.URL.Query().Get("count") if len(count) != 0 { - n, err := strconv.ParseUint(count, 10, 32) + n, err := strconv.Atoi(count) if err != nil { return opt, fmt.Errorf("failed to parse 'count' option: %v", count) } - opt.Count = int(n) + if n < -1 { + return opt, fmt.Errorf("invalid 'count' option: only -1 and larger values allowed, not %d", n) + } + opt.Count = n } recursive := r.URL.Query().Get("recursive") if recursive == "true" { diff --git a/info/v2/container.go b/info/v2/container.go index 4ee3b81793..15fb79b9ea 100644 --- a/info/v2/container.go +++ b/info/v2/container.go @@ -265,7 +265,7 @@ type FsInfo struct { type RequestOptions struct { // Type of container identifier specified - TypeName (default) or TypeDocker IdType string `json:"type"` - // Number of stats to return + // Number of stats to return, -1 means no limit. Count int `json:"count"` // Whether to include stats for child subcontainers. Recursive bool `json:"recursive"`