File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1515package image
1616
1717import (
18- "encoding/json"
1918 "io"
2019 "io/ioutil"
2120 "net/http"
@@ -79,8 +78,8 @@ func Autodetect(path string) (string, error) {
7978
8079 header := struct {
8180 SchemaVersion int `json:"schemaVersion"`
82- MediaType string `json:"mediaType"`
8381 Config interface {} `json:"config"`
82+ Manifests interface {} `json:"manifests"`
8483 }{}
8584
8685 if err := json .NewDecoder (f ).Decode (& header ); err != nil {
@@ -97,16 +96,17 @@ func Autodetect(path string) (string, error) {
9796 }
9897
9998 switch {
100- case header .MediaType == string ( schema . MediaTypeManifest ) :
99+ case header .SchemaVersion == 2 && header . Config != nil :
101100 return TypeManifest , nil
102101
103- case header .MediaType == string ( schema . MediaTypeManifestList ) :
102+ case header .Manifests != nil :
104103 return TypeManifestList , nil
105104
106- case header .MediaType == "" && header . SchemaVersion == 0 && header .Config != nil :
105+ case header .SchemaVersion == 0 && header .Config != nil :
107106 // config files don't have mediaType/schemaVersion header
108107 return TypeConfig , nil
109108 }
110109
111110 return "" , errors .New ("unknown media type" )
111+
112112}
You can’t perform that action at this time.
0 commit comments