diff options
-rw-r--r-- | pkg/app/handler/glsa/comments.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/app/handler/glsa/comments.go b/pkg/app/handler/glsa/comments.go index a3afe0b..73d11c2 100644 --- a/pkg/app/handler/glsa/comments.go +++ b/pkg/app/handler/glsa/comments.go @@ -10,6 +10,7 @@ import ( "glsamaker/pkg/models/users" "encoding/json" "errors" + "html" "net/http" "strconv" "time" @@ -41,6 +42,15 @@ func AddComment(w http.ResponseWriter, r *http.Request) { return } + newComment.Message = html.EscapeString(newComment.Message) + newComment.User = &users.User{ + Id: newComment.User.Id, + Email: newComment.User.Email, + Nick: newComment.User.Nick, + Name: newComment.User.Name, + Badge: newComment.User.Badge, + } + newCommentString, _ := json.Marshal(newComment) w.Write(newCommentString) |