diff --git a/go.mod b/go.mod index d8483e1..4eb506d 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 2ba0aaa..a5194af 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/repository/notificationrepository/notification_db_models.go b/pkg/repository/notificationrepository/notification_db_models.go index 3b7ad5c..bd8efcf 100644 --- a/pkg/repository/notificationrepository/notification_db_models.go +++ b/pkg/repository/notificationrepository/notification_db_models.go @@ -73,9 +73,11 @@ func (n *notificationRow) ToNotificationModel() (models.Notification, error) { // CustomFields is set below } - err := json.Unmarshal(n.CustomFields, ¬ification.CustomFields) - if err != nil { - return empty, err + if len(n.CustomFields) > 0 { + err := json.Unmarshal(n.CustomFields, ¬ification.CustomFields) + if err != nil { + return empty, err + } } return notification, nil