Skip to content

Commit

Permalink
Fix JSON unmarshalling issue in Validate method.
Browse files Browse the repository at this point in the history
Replaced hardcoded string concatenation with fmt.Sprintf for better readability and maintainability. This change ensures that the JSON string is correctly formatted before unmarshalling.
  • Loading branch information
rolandgroen committed Oct 14, 2024
1 parent 6ed82f4 commit ef8021f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion uzi_vc_validator/ura_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type JwtHeaderValues struct {

func (u UraValidatorImpl) Validate(jwtString string) error {
credential := &vc.VerifiableCredential{}
err := json.Unmarshal([]byte("\""+jwtString+"\""), credential)
err := json.Unmarshal([]byte(fmt.Sprintf("\"%s\"", jwtString)), credential)
if err != nil {
return err
}
Expand Down

0 comments on commit ef8021f

Please sign in to comment.