From ad5a149f64999ffec634f9d8073596b9f62d7368 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sat, 11 Feb 2023 19:56:27 -0500 Subject: [PATCH] safer to use templates sprintf to build html --- hoot.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hoot.go b/hoot.go index 58b2fdb..5ebedee 100644 --- a/hoot.go +++ b/hoot.go @@ -26,6 +26,7 @@ import ( "github.com/andybalholm/cascadia" "golang.org/x/net/html" "humungus.tedunangst.com/r/webs/htfilter" + "humungus.tedunangst.com/r/webs/templates" ) var tweetsel = cascadia.MustCompile("div[data-testid=tweetText]") @@ -57,7 +58,7 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string { if htfilter.HasClass(node, "Emoji") && alt != "" { return alt } - return fmt.Sprintf(" %s", htfilter.GetAttr(node, "src"), alt) + return string(templates.Sprintf(" %s", htfilter.GetAttr(node, "src"), alt)) } var buf strings.Builder