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 603bdc2
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
}
}
return metadata
}

0 comments on commit 603bdc2

Please # to comment.