Merge pull request #42716 from rvolosatovs/discard_type_pre_1_42

API: discard `/system/df` `type` parameter pre-1.42
This commit is contained in:
Sebastiaan van Stijn 2021-08-07 15:46:03 +02:00 committed by GitHub
commit 91dc595e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -94,8 +94,11 @@ func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter,
return err
}
version := httputils.VersionFromContext(ctx)
var getContainers, getImages, getVolumes, getBuildCache bool
if typeStrs, ok := r.Form["type"]; !ok {
typeStrs, ok := r.Form["type"]
if versions.LessThan(version, "1.42") || !ok {
getContainers, getImages, getVolumes, getBuildCache = true, true, true, true
} else {
for _, typ := range typeStrs {
@ -151,7 +154,7 @@ func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter,
}
var builderSize int64
if versions.LessThan(httputils.VersionFromContext(ctx), "1.42") {
if versions.LessThan(version, "1.42") {
for _, b := range buildCache {
builderSize += b.Size
}