Skip to content

Commit

Permalink
remove TODO
Browse files Browse the repository at this point in the history
Signed-off-by: Lixia (Sylvia) Lei <[email protected]>
  • Loading branch information
Wwwsylvia committed Jan 21, 2025
1 parent 1c1194a commit 00fce8e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
4 changes: 0 additions & 4 deletions registry/remote/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -1608,10 +1608,6 @@ func (s *manifestStore) generateDescriptor(resp *http.Response, ref registry.Ref
// calculateDigestFromResponse calculates the actual digest of the response body
// taking care not to destroy it in the process.
func calculateDigestFromResponse(resp *http.Response, maxMetadataBytes int64) (digest.Digest, error) {
// TODO: move this to another PR
if resp.Body == nil {
return "", fmt.Errorf("%s %q: response body is nil", resp.Request.Method, resp.Request.URL)
}
defer resp.Body.Close()

body := limitReader(resp.Body, maxMetadataBytes)
Expand Down
47 changes: 0 additions & 47 deletions registry/remote/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7815,53 +7815,6 @@ func TestManifestStore_generateDescriptor(t *testing.T) {
wantDescriptor: ocispec.Descriptor{},
wantErr: true,
},
{
name: "resp with body, missing Docker-Content-Digest",
resp: &http.Response{
Header: http.Header{
"Content-Type": []string{mediaType},
},
ContentLength: dataSize,
Request: &http.Request{
Method: http.MethodGet,
URL: &url.URL{Path: "/test"},
},
Body: io.NopCloser(bytes.NewReader(data)),
},
ref: registry.Reference{
Registry: "registry.example.com",
Repository: "hello-world",
Reference: dataDigest.String(),
},
httpMethod: http.MethodGet,
wantDescriptor: ocispec.Descriptor{
MediaType: mediaType,
Digest: dataDigest,
Size: dataSize,
},
wantErr: false,
},
{
name: "resp without body, missing Docker-Content-Digest",
resp: &http.Response{
Header: http.Header{
"Content-Type": []string{mediaType},
},
ContentLength: dataSize,
Request: &http.Request{
Method: http.MethodGet,
URL: &url.URL{Path: "/test"},
},
},
ref: registry.Reference{
Registry: "registry.example.com",
Repository: "hello-world",
Reference: dataDigest.String(),
},
httpMethod: http.MethodGet,
wantDescriptor: ocispec.Descriptor{},
wantErr: true,
},
{
name: "failed to read resp with body, missing Docker-Content-Digest",
resp: &http.Response{
Expand Down

0 comments on commit 00fce8e

Please sign in to comment.