Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
Signed-off-by: James Alseth <[email protected]>
  • Loading branch information
jalseth committed Jul 30, 2023
1 parent bb128a6 commit 15c34c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/tle/tle.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ func GenerateTransparencyLogEntry(anon models.LogEntryAnon) (*rekor_pb.Transpare

// Different call paths may supply string or []byte. If string, it is base64 encoded.
var body []byte
switch x := anon.Body.(type) {
switch v := anon.Body.(type) {
case string:
b, err := base64.StdEncoding.DecodeString(x)
b, err := base64.StdEncoding.DecodeString(v)
if err != nil {
return nil, fmt.Errorf("base64 decoding body: %w", err)
}
body = b
case []byte:
body = x
body = v
default:
return nil, fmt.Errorf("body is not string or []byte: (%T)%v", x, x)
return nil, fmt.Errorf("body is not string or []byte: (%T)%v", v, v)
}

pe, err := models.UnmarshalProposedEntry(bytes.NewReader(body), runtime.JSONConsumer())
Expand Down

0 comments on commit 15c34c1

Please sign in to comment.