mirror of
https://github.com/containers/skopeo.git
synced 2025-10-23 04:01:36 +00:00
vendor containers/image for better registry errors
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
17
vendor/github.com/containers/image/docker/docker_image_src.go
generated
vendored
17
vendor/github.com/containers/image/docker/docker_image_src.go
generated
vendored
@@ -13,18 +13,9 @@ import (
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/containers/image/manifest"
|
||||
"github.com/containers/image/types"
|
||||
"github.com/docker/distribution/registry/client"
|
||||
)
|
||||
|
||||
// ErrFetchManifest provides the error when fetching the manifest fails
|
||||
type ErrFetchManifest struct {
|
||||
statusCode int
|
||||
body []byte
|
||||
}
|
||||
|
||||
func (e ErrFetchManifest) Error() string {
|
||||
return fmt.Sprintf("error fetching manifest: status code: %d, body: %s", e.statusCode, string(e.body))
|
||||
}
|
||||
|
||||
type dockerImageSource struct {
|
||||
ref dockerReference
|
||||
requestedManifestMIMETypes []string
|
||||
@@ -93,13 +84,13 @@ func (s *dockerImageSource) fetchManifest(tagOrDigest string) ([]byte, string, e
|
||||
return nil, "", err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return nil, "", client.HandleErrorResponse(res)
|
||||
}
|
||||
manblob, err := ioutil.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return nil, "", ErrFetchManifest{res.StatusCode, manblob}
|
||||
}
|
||||
return manblob, simplifyContentType(res.Header.Get("Content-Type")), nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user