Skip to content

Commit

Permalink
Update notation.go
Browse files Browse the repository at this point in the history
Co-authored-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Pritesh Bandi <priteshbandi@gmail.com>
  • Loading branch information
priteshbandi and shizhMSFT committed Mar 13, 2024
1 parent 5e8f245 commit e8f77a8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions notation.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,14 +517,14 @@ func generateAnnotations(signerInfo *signature.SignerInfo, annotations map[strin

func getDescriptorFunc(ctx context.Context, reader io.Reader, contentMediaType string, userMetadata map[string]string) BlobDescriptorGenerator {
return func(hashAlgo digest.Algorithm) (ocispec.Descriptor, error) {
h := hashAlgo.Hash()
bytes, err := io.Copy(hashAlgo.Hash(), reader)
digester := hashAlgo.Digester()
bytes, err := io.Copy(digester.Hash(), reader)
if err != nil {
return ocispec.Descriptor{}, err
}
targetDesc := ocispec.Descriptor{
MediaType: contentMediaType,
Digest: digest.NewDigest(hashAlgo, h),
Digest: digester.Digest(),
Size: bytes,
}
return addUserMetadataToDescriptor(ctx, targetDesc, userMetadata)
Expand Down

0 comments on commit e8f77a8

Please sign in to comment.