html escape summary fields

This commit is contained in:
Ted Unangst 2019-10-06 15:23:42 -04:00
parent 683818efcb
commit a0b6756206
2 changed files with 3 additions and 3 deletions

View File

@ -20,6 +20,7 @@ import (
"crypto/rsa" "crypto/rsa"
"database/sql" "database/sql"
"fmt" "fmt"
"html"
"io" "io"
"log" "log"
notrand "math/rand" notrand "math/rand"
@ -992,7 +993,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
} }
translate(h) translate(h)
h.Noise = re_memes.ReplaceAllString(h.Noise, "") h.Noise = re_memes.ReplaceAllString(h.Noise, "")
jo["summary"] = h.Precis jo["summary"] = html.EscapeString(h.Precis)
jo["content"] = ontologize(mentionize(h.Noise)) jo["content"] = ontologize(mentionize(h.Noise))
if strings.HasPrefix(h.Precis, "DZ:") { if strings.HasPrefix(h.Precis, "DZ:") {
jo["sensitive"] = true jo["sensitive"] = true
@ -1070,7 +1071,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
jd := junk.New() jd := junk.New()
jd["mediaType"] = d.Media jd["mediaType"] = d.Media
jd["name"] = d.Name jd["name"] = d.Name
jd["summary"] = d.Desc jd["summary"] = html.EscapeString(d.Desc)
jd["type"] = "Document" jd["type"] = "Document"
jd["url"] = d.URL jd["url"] = d.URL
atts = append(atts, jd) atts = append(atts, jd)

View File

@ -23,7 +23,6 @@ import (
"golang.org/x/net/html" "golang.org/x/net/html"
) )
var re_bolder = regexp.MustCompile(`(^|\W)\*\*([\w\s,.!?':_-]+)\*\*($|\W)`) var re_bolder = regexp.MustCompile(`(^|\W)\*\*([\w\s,.!?':_-]+)\*\*($|\W)`)
var re_italicer = regexp.MustCompile(`(^|\W)\*([\w\s,.!?':_-]+)\*($|\W)`) var re_italicer = regexp.MustCompile(`(^|\W)\*([\w\s,.!?':_-]+)\*($|\W)`)
var re_bigcoder = regexp.MustCompile("```\n?((?s:.*?))\n?```\n?") var re_bigcoder = regexp.MustCompile("```\n?((?s:.*?))\n?```\n?")