Skip to content

Commit

Permalink
fix: jsonMarshal string empty check
Browse files Browse the repository at this point in the history
  • Loading branch information
mahendraintelops committed Dec 2, 2023
1 parent c82e053 commit 87024ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ func validate(compageJSON *core.CompageJSON) error {
// GetMetadata converts string to map
func GetMetadata(metadataInput string) map[string]interface{} {
metadata := map[string]interface{}{}
if err0 := json.Unmarshal([]byte(metadataInput), &metadata); err0 != nil {
log.Errorf("error unmarshalling metadata: %v", err0)
return nil
if len(metadataInput) > 0 {
if err0 := json.Unmarshal([]byte(metadataInput), &metadata); err0 != nil {
log.Errorf("error unmarshalling metadata: %v", err0)
return nil
}

Check warning on line 134 in internal/converter/converter.go

View check run for this annotation

Codecov / codecov/patch

internal/converter/converter.go#L131-L134

Added lines #L131 - L134 were not covered by tests
}
return metadata
}

0 comments on commit 87024ef

Please sign in to comment.