Skip to content

Commit

Permalink
fix json unmarshal bug (#747)
Browse files Browse the repository at this point in the history
Signed-off-by: cndoit18 <cndoit18@outlook.com>
  • Loading branch information
cndoit18 committed Aug 16, 2021
1 parent c6e2642 commit f80845d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apis/goharbor.io/v1beta1/harbor_configuration.go
Expand Up @@ -94,8 +94,12 @@ func (h HarborConfigurationSpec) ToJSON() ([]byte, error) {
return nil, err
}

extension := make(map[string]interface{})
if json.Unmarshal(h.Extension.Raw, &extension) != nil {
if len(h.Extension.Raw) > 0 {
extension := make(map[string]interface{})
if err = json.Unmarshal(h.Extension.Raw, &extension); err != nil {
return nil, err
}

delete(data, "extension")

for k, v := range extension {
Expand Down

0 comments on commit f80845d

Please sign in to comment.