From a0b6756206987d346c12eece7ef406c3b8077194 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sun, 6 Oct 2019 15:23:42 -0400 Subject: [PATCH] html escape summary fields --- activity.go | 5 +++-- markitzero.go | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/activity.go b/activity.go index 81d4dc7..4683efc 100644 --- a/activity.go +++ b/activity.go @@ -20,6 +20,7 @@ import ( "crypto/rsa" "database/sql" "fmt" + "html" "io" "log" notrand "math/rand" @@ -992,7 +993,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { } translate(h) h.Noise = re_memes.ReplaceAllString(h.Noise, "") - jo["summary"] = h.Precis + jo["summary"] = html.EscapeString(h.Precis) jo["content"] = ontologize(mentionize(h.Noise)) if strings.HasPrefix(h.Precis, "DZ:") { jo["sensitive"] = true @@ -1070,7 +1071,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { jd := junk.New() jd["mediaType"] = d.Media jd["name"] = d.Name - jd["summary"] = d.Desc + jd["summary"] = html.EscapeString(d.Desc) jd["type"] = "Document" jd["url"] = d.URL atts = append(atts, jd) diff --git a/markitzero.go b/markitzero.go index ade5089..7e0b668 100644 --- a/markitzero.go +++ b/markitzero.go @@ -23,7 +23,6 @@ import ( "golang.org/x/net/html" ) - var re_bolder = regexp.MustCompile(`(^|\W)\*\*([\w\s,.!?':_-]+)\*\*($|\W)`) var re_italicer = regexp.MustCompile(`(^|\W)\*([\w\s,.!?':_-]+)\*($|\W)`) var re_bigcoder = regexp.MustCompile("```\n?((?s:.*?))\n?```\n?")