Skip to content

Commit

Permalink
adding missing error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed Alsabag <ahmed.alsabag@gmail.com>
  • Loading branch information
aalsabag committed Jun 6, 2024
1 parent 0f380d6 commit 0cfb306
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion internal/attest/attest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ func TestAttestCommitRef(t *testing.T) {
name := "test.json"
content := readFile(t, filepath.Join("testdata/", name))

cfg, _ := gitsignconfig.Get()
cfg, err := gitsignconfig.Get()
if err != nil {
t.Fatal(err)
}

attestor := NewAttestor(repo, sv, fakeRekor, cfg)

Expand Down
5 changes: 4 additions & 1 deletion internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func certFingerprint(cert *x509.Certificate) []byte {

// StripURL returns the baseHost with the basePath given a full endpoint
func StripURL(endpoint string) (string, string) {
u, _ := url.Parse(endpoint)
u, err := url.Parse(endpoint)
if err != nil {
return "", ""
}
return u.Host, u.Path
}

0 comments on commit 0cfb306

Please sign in to comment.