mirror of https://github.com/docker/docs.git
Vendor updated distribution package
Another day, another revendor. This revision of distribution is more tolerant of incorrect Content-Type headers when fetching manifests. Fixes #19526 Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
7d19ca7c40
commit
921eae9d6d
|
@ -46,7 +46,7 @@ clone git github.com/boltdb/bolt v1.1.0
|
||||||
clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
|
clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
|
||||||
|
|
||||||
# get graph and distribution packages
|
# get graph and distribution packages
|
||||||
clone git github.com/docker/distribution 08650825fef9f21ea819972fb2ed875c0832a255
|
clone git github.com/docker/distribution c301f8ab27f4913c968b8d73a38e5dda79b9d3d7
|
||||||
clone git github.com/vbatts/tar-split v0.9.11
|
clone git github.com/vbatts/tar-split v0.9.11
|
||||||
|
|
||||||
# get desired notary commit, might also need to be updated in Dockerfile
|
# get desired notary commit, might also need to be updated in Dockerfile
|
||||||
|
|
|
@ -2,7 +2,7 @@ package distribution
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"mime"
|
||||||
|
|
||||||
"github.com/docker/distribution/context"
|
"github.com/docker/distribution/context"
|
||||||
"github.com/docker/distribution/digest"
|
"github.com/docker/distribution/digest"
|
||||||
|
@ -84,19 +84,23 @@ var mappings = make(map[string]UnmarshalFunc, 0)
|
||||||
// UnmarshalManifest looks up manifest unmarshall functions based on
|
// UnmarshalManifest looks up manifest unmarshall functions based on
|
||||||
// MediaType
|
// MediaType
|
||||||
func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error) {
|
func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error) {
|
||||||
// Need to look up by the actual content type, not the raw contents of
|
// Need to look up by the actual media type, not the raw contents of
|
||||||
// the header. Strip semicolons and anything following them.
|
// the header. Strip semicolons and anything following them.
|
||||||
var mediatype string
|
var mediatype string
|
||||||
semicolonIndex := strings.Index(ctHeader, ";")
|
if ctHeader != "" {
|
||||||
if semicolonIndex != -1 {
|
var err error
|
||||||
mediatype = ctHeader[:semicolonIndex]
|
mediatype, _, err = mime.ParseMediaType(ctHeader)
|
||||||
} else {
|
if err != nil {
|
||||||
mediatype = ctHeader
|
return nil, Descriptor{}, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unmarshalFunc, ok := mappings[mediatype]
|
unmarshalFunc, ok := mappings[mediatype]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, Descriptor{}, fmt.Errorf("unsupported manifest mediatype: %s", mediatype)
|
unmarshalFunc, ok = mappings[""]
|
||||||
|
if !ok {
|
||||||
|
return nil, Descriptor{}, fmt.Errorf("unsupported manifest mediatype and no default available: %s", mediatype)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return unmarshalFunc(p)
|
return unmarshalFunc(p)
|
||||||
|
|
Loading…
Reference in New Issue