From ef8021f1394ca83d0ae69785b9f68c9ee1b95c77 Mon Sep 17 00:00:00 2001 From: Roland Groen Date: Tue, 15 Oct 2024 00:29:31 +0200 Subject: [PATCH] Fix JSON unmarshalling issue in Validate method. Replaced hardcoded string concatenation with fmt.Sprintf for better readability and maintainability. This change ensures that the JSON string is correctly formatted before unmarshalling. --- uzi_vc_validator/ura_validator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uzi_vc_validator/ura_validator.go b/uzi_vc_validator/ura_validator.go index a7b4bf5..dc140a8 100644 --- a/uzi_vc_validator/ura_validator.go +++ b/uzi_vc_validator/ura_validator.go @@ -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 }