compat: add shared-size par to GET /images/json

Related: https://issues.redhat.com/browse/RUN-2698

Signed-off-by: Nicola Sella <nsella@redhat.com>
This commit is contained in:
Nicola Sella
2025-05-15 18:39:38 +02:00
parent b97937ecc4
commit b0e7a2ec9b
2 changed files with 15 additions and 3 deletions

View File

@ -416,9 +416,10 @@ func GetImages(w http.ResponseWriter, r *http.Request) {
decoder := utils.GetDecoder(r)
runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime)
query := struct {
All bool
Digests bool
Filter string // Docker 1.24 compatibility
All bool
Digests bool
Filter string // Docker 1.24 compatibility
SharedSize bool `schema:"shared-size"` // Docker 1.42 compatibility
}{
// This is where you can override the golang default value for one of fields
}
@ -477,6 +478,10 @@ func GetImages(w http.ResponseWriter, r *http.Request) {
if s.RepoDigests == nil {
s.RepoDigests = []string{}
}
// Docker 1.42 sets SharedSize to -1 if ont passed explicitly
if !query.SharedSize {
s.SharedSize = -1
}
}
}
utils.WriteResponse(w, http.StatusOK, summaries)