fix e2e test failure

it is possible for layers.names to be nil and we must account for that.

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2020-01-10 10:26:43 -06:00
parent c3956b1974
commit 986feef2e8
2 changed files with 6 additions and 10 deletions

View File

@ -841,15 +841,17 @@ func (i *Image) History(ctx context.Context) ([]*History, error) {
delete(topLayerMap, layer.ID)
}
}
allHistory = append(allHistory, &History{
h := History{
ID: id,
Created: oci.History[x].Created,
CreatedBy: oci.History[x].CreatedBy,
Size: size,
Comment: oci.History[x].Comment,
Tags: layer.Names,
})
}
if layer != nil {
h.Tags = layer.Names
}
allHistory = append(allHistory, &h)
if layer != nil && layer.Parent != "" && !oci.History[x].EmptyLayer {
layer, err = i.imageruntime.store.Layer(layer.Parent)

View File

@ -19,12 +19,6 @@ import (
)
func BuildImage(w http.ResponseWriter, r *http.Request) {
// contentType := r.Header.Get("Content-Type")
// if contentType != "application/x-tar" {
// Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest, errors.New("/build expects Content-Type of 'application/x-tar'"))
// return
// }
authConfigs := map[string]AuthConfig{}
if hasHeader(r, "X-Registry-Config") {
registryHeader := getHeader(r, "X-Registry-Config")