digest: use digest.Parse over ParseDigest
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
d5cc235c48
commit
01dfa0fcb9
7 changed files with 10 additions and 10 deletions
|
@ -170,7 +170,7 @@ func Parse(s string) (Reference, error) {
|
||||||
}
|
}
|
||||||
if matches[3] != "" {
|
if matches[3] != "" {
|
||||||
var err error
|
var err error
|
||||||
ref.digest, err = digest.ParseDigest(matches[3])
|
ref.digest, err = digest.Parse(matches[3])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,7 @@ func descriptorFromResponse(response *http.Response) (distribution.Descriptor, e
|
||||||
return desc, nil
|
return desc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
dgst, err := digest.ParseDigest(digestHeader)
|
dgst, err := digest.Parse(digestHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return distribution.Descriptor{}, err
|
return distribution.Descriptor{}, err
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ func (ms *manifests) Get(ctx context.Context, dgst digest.Digest, options ...dis
|
||||||
return nil, distribution.ErrManifestNotModified
|
return nil, distribution.ErrManifestNotModified
|
||||||
} else if SuccessStatus(resp.StatusCode) {
|
} else if SuccessStatus(resp.StatusCode) {
|
||||||
if contentDgst != nil {
|
if contentDgst != nil {
|
||||||
dgst, err := digest.ParseDigest(resp.Header.Get("Docker-Content-Digest"))
|
dgst, err := digest.Parse(resp.Header.Get("Docker-Content-Digest"))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
*contentDgst = dgst
|
*contentDgst = dgst
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ func (ms *manifests) Put(ctx context.Context, m distribution.Manifest, options .
|
||||||
|
|
||||||
if SuccessStatus(resp.StatusCode) {
|
if SuccessStatus(resp.StatusCode) {
|
||||||
dgstHeader := resp.Header.Get("Docker-Content-Digest")
|
dgstHeader := resp.Header.Get("Docker-Content-Digest")
|
||||||
dgst, err := digest.ParseDigest(dgstHeader)
|
dgst, err := digest.Parse(dgstHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ func (buh *blobUploadHandler) PutBlobUploadComplete(w http.ResponseWriter, r *ht
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dgst, err := digest.ParseDigest(dgstStr)
|
dgst, err := digest.Parse(dgstStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// no digest? return error, but allow retry.
|
// no digest? return error, but allow retry.
|
||||||
buh.Errors = append(buh.Errors, v2.ErrorCodeDigestInvalid.WithDetail("digest parsing failed"))
|
buh.Errors = append(buh.Errors, v2.ErrorCodeDigestInvalid.WithDetail("digest parsing failed"))
|
||||||
|
@ -329,7 +329,7 @@ func (buh *blobUploadHandler) blobUploadResponse(w http.ResponseWriter, r *http.
|
||||||
// successful, the blob is linked into the blob store and 201 Created is
|
// successful, the blob is linked into the blob store and 201 Created is
|
||||||
// returned with the canonical url of the blob.
|
// returned with the canonical url of the blob.
|
||||||
func (buh *blobUploadHandler) createBlobMountOption(fromRepo, mountDigest string) (distribution.BlobCreateOption, error) {
|
func (buh *blobUploadHandler) createBlobMountOption(fromRepo, mountDigest string) (distribution.BlobCreateOption, error) {
|
||||||
dgst, err := digest.ParseDigest(mountDigest)
|
dgst, err := digest.Parse(mountDigest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ func getDigest(ctx context.Context) (dgst digest.Digest, err error) {
|
||||||
return "", errDigestNotAvailable
|
return "", errDigestNotAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
d, err := digest.ParseDigest(dgstStr)
|
d, err := digest.Parse(dgstStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctxu.GetLogger(ctx).Errorf("error parsing digest=%q: %v", dgstStr, err)
|
ctxu.GetLogger(ctx).Errorf("error parsing digest=%q: %v", dgstStr, err)
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
@ -33,7 +33,7 @@ func imageManifestDispatcher(ctx *Context, r *http.Request) http.Handler {
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
}
|
}
|
||||||
reference := getReference(ctx)
|
reference := getReference(ctx)
|
||||||
dgst, err := digest.ParseDigest(reference)
|
dgst, err := digest.Parse(reference)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// We just have a tag
|
// We just have a tag
|
||||||
imageManifestHandler.Tag = reference
|
imageManifestHandler.Tag = reference
|
||||||
|
|
|
@ -145,7 +145,7 @@ func (bs *blobStore) readlink(ctx context.Context, path string) (digest.Digest,
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
linked, err := digest.ParseDigest(string(content))
|
linked, err := digest.Parse(string(content))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ type Vacuum struct {
|
||||||
|
|
||||||
// RemoveBlob removes a blob from the filesystem
|
// RemoveBlob removes a blob from the filesystem
|
||||||
func (v Vacuum) RemoveBlob(dgst string) error {
|
func (v Vacuum) RemoveBlob(dgst string) error {
|
||||||
d, err := digest.ParseDigest(dgst)
|
d, err := digest.Parse(dgst)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue