Skip to content

Commit

Permalink
update return
Browse files Browse the repository at this point in the history
Signed-off-by: Asra Ali <[email protected]>
  • Loading branch information
asraa committed Jan 3, 2023
1 parent 2377d9d commit 40da2c4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/cosign/cli/attest/attest_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,18 @@ func (c *AttestBlobCommand) Exec(ctx context.Context, artifactPath string) error
// signer is a certificate
if err != nil {
fmt.Fprintln(os.Stderr, "Could not output signer certificate. Was a certificate used? ", err)
return nil

}
if len(cert) != 1 {
fmt.Fprintln(os.Stderr, "Could not output signer certificate. Expected a single certificate")
return nil
}
if err == nil && len(cert) == 1 {
bts := signer
if err := os.WriteFile(c.OutputCertificate, bts, 0600); err != nil {
return fmt.Errorf("create certificate file: %w", err)
}
fmt.Fprintln(os.Stderr, "Certificate written to file ", c.OutputCertificate)
bts := signer
if err := os.WriteFile(c.OutputCertificate, bts, 0600); err != nil {
return fmt.Errorf("create certificate file: %w", err)
}
fmt.Fprintln(os.Stderr, "Certificate written to file ", c.OutputCertificate)
}

return nil
Expand Down

0 comments on commit 40da2c4

Please sign in to comment.