diff --git a/Gopkg.lock b/Gopkg.lock index 0fff27aa..bd85b19d 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -297,7 +297,7 @@ branch = "master" name = "github.com/rusenask/docker-registry-client" packages = ["registry"] - revision = "bf1d91b397917b39e5f0478dd679c8aa224ca91e" + revision = "436ed392ccd5672e03547025aef646a2eef90057" [[projects]] branch = "master" diff --git a/vendor/github.com/rusenask/docker-registry-client/registry/manifest.go b/vendor/github.com/rusenask/docker-registry-client/registry/manifest.go index 5bfabe43..8cd42583 100644 --- a/vendor/github.com/rusenask/docker-registry-client/registry/manifest.go +++ b/vendor/github.com/rusenask/docker-registry-client/registry/manifest.go @@ -82,14 +82,23 @@ func (registry *Registry) ManifestDigest(repository, reference string) (digest.D req.Header.Set("Accept", manifestV2.MediaTypeManifest) resp, err := registry.Client.Do(req) - if resp != nil { - defer resp.Body.Close() + if err != nil { + return "", err } + defer resp.Body.Close() + + if hdr := resp.Header.Get("Docker-Content-Digest"); hdr != "" { + return digest.Parse(hdr) + } + + // Try to get digest from body instead, should be equal to what would be presented + // in Docker-Content-Digest + body, err := ioutil.ReadAll(resp.Body) if err != nil { return "", err } - return digest.Parse(resp.Header.Get("Docker-Content-Digest")) + return digest.FromBytes(body), nil } func (registry *Registry) DeleteManifest(repository string, digest digest.Digest) error {