Skip to content

Commit

Permalink
fix: close files (#3109)
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke authored Sep 22, 2024
1 parent 79113f7 commit 1d16bfc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/cosign/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (v *Verifier) downloadFile(ctx context.Context, logE *logrus.Entry, rt *run
return fileName, nil
}

// art is used to render the template.
func (v *Verifier) Verify(ctx context.Context, logE *logrus.Entry, rt *runtime.Runtime, file *download.File, cos *registry.Cosign, art *template.Artifact, verifiedFilePath string) error {
if v.disabled {
logE.Debug("verification with cosign is disabled")
Expand Down Expand Up @@ -167,6 +168,7 @@ func (v *Verifier) downloadCosignFile(ctx context.Context, logE *logrus.Entry, f
if err != nil {
return fmt.Errorf("get a readcloser: %w", err)
}
defer rc.Close()
if _, err := io.Copy(tf, rc); err != nil {
return fmt.Errorf("download a file: %w", err)
}
Expand Down

0 comments on commit 1d16bfc

Please sign in to comment.