Skip to content

Commit

Permalink
fix: fix unmarshalling invalid custom field input and upgrade depende…
Browse files Browse the repository at this point in the history
…ncies (#21)
  • Loading branch information
endyApina authored Jun 17, 2024
2 parents 28079cb + 1fc1898 commit 7c00330
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/gin-contrib/logger v1.1.2
github.com/gin-gonic/gin v1.10.0
github.com/golang-migrate/migrate/v4 v4.17.1
github.com/greenbone/opensight-golang-libraries v1.7.5
github.com/greenbone/opensight-golang-libraries v1.7.6
github.com/jmoiron/sqlx v1.4.0
github.com/rs/zerolog v1.33.0
github.com/samber/lo v1.39.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/greenbone/opensight-golang-libraries v1.7.5 h1:V0zaiwr8/kokfutTnKOV/DsciotYEnKi9zA+0sMjEKw=
github.com/greenbone/opensight-golang-libraries v1.7.5/go.mod h1:k2cGaL0Y3rc5qWBeK/BeHJvJnCNdrStRtnNp5ggme9o=
github.com/greenbone/opensight-golang-libraries v1.7.6 h1:FbgtG9rkXjasm46vCVS1KIKuxEX2afs6FjqYsl82drc=
github.com/greenbone/opensight-golang-libraries v1.7.6/go.mod h1:k2cGaL0Y3rc5qWBeK/BeHJvJnCNdrStRtnNp5ggme9o=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ func (n *notificationRow) ToNotificationModel() (models.Notification, error) {
// CustomFields is set below
}

err := json.Unmarshal(n.CustomFields, &notification.CustomFields)
if err != nil {
return empty, err
if len(n.CustomFields) > 0 {
err := json.Unmarshal(n.CustomFields, &notification.CustomFields)
if err != nil {
return empty, err
}
}

return notification, nil
Expand Down

0 comments on commit 7c00330

Please sign in to comment.