Skip to content

Commit 00fce8e

Browse files
committed
remove TODO
Signed-off-by: Lixia (Sylvia) Lei <[email protected]>
1 parent 1c1194a commit 00fce8e

File tree

2 files changed

+0
-51
lines changed

2 files changed

+0
-51
lines changed

registry/remote/repository.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,10 +1608,6 @@ func (s *manifestStore) generateDescriptor(resp *http.Response, ref registry.Ref
16081608
// calculateDigestFromResponse calculates the actual digest of the response body
16091609
// taking care not to destroy it in the process.
16101610
func calculateDigestFromResponse(resp *http.Response, maxMetadataBytes int64) (digest.Digest, error) {
1611-
// TODO: move this to another PR
1612-
if resp.Body == nil {
1613-
return "", fmt.Errorf("%s %q: response body is nil", resp.Request.Method, resp.Request.URL)
1614-
}
16151611
defer resp.Body.Close()
16161612

16171613
body := limitReader(resp.Body, maxMetadataBytes)

registry/remote/repository_test.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7815,53 +7815,6 @@ func TestManifestStore_generateDescriptor(t *testing.T) {
78157815
wantDescriptor: ocispec.Descriptor{},
78167816
wantErr: true,
78177817
},
7818-
{
7819-
name: "resp with body, missing Docker-Content-Digest",
7820-
resp: &http.Response{
7821-
Header: http.Header{
7822-
"Content-Type": []string{mediaType},
7823-
},
7824-
ContentLength: dataSize,
7825-
Request: &http.Request{
7826-
Method: http.MethodGet,
7827-
URL: &url.URL{Path: "/test"},
7828-
},
7829-
Body: io.NopCloser(bytes.NewReader(data)),
7830-
},
7831-
ref: registry.Reference{
7832-
Registry: "registry.example.com",
7833-
Repository: "hello-world",
7834-
Reference: dataDigest.String(),
7835-
},
7836-
httpMethod: http.MethodGet,
7837-
wantDescriptor: ocispec.Descriptor{
7838-
MediaType: mediaType,
7839-
Digest: dataDigest,
7840-
Size: dataSize,
7841-
},
7842-
wantErr: false,
7843-
},
7844-
{
7845-
name: "resp without body, missing Docker-Content-Digest",
7846-
resp: &http.Response{
7847-
Header: http.Header{
7848-
"Content-Type": []string{mediaType},
7849-
},
7850-
ContentLength: dataSize,
7851-
Request: &http.Request{
7852-
Method: http.MethodGet,
7853-
URL: &url.URL{Path: "/test"},
7854-
},
7855-
},
7856-
ref: registry.Reference{
7857-
Registry: "registry.example.com",
7858-
Repository: "hello-world",
7859-
Reference: dataDigest.String(),
7860-
},
7861-
httpMethod: http.MethodGet,
7862-
wantDescriptor: ocispec.Descriptor{},
7863-
wantErr: true,
7864-
},
78657818
{
78667819
name: "failed to read resp with body, missing Docker-Content-Digest",
78677820
resp: &http.Response{

0 commit comments

Comments
 (0)