safer to use templates sprintf to build html
Ted Unangst tedu@tedunangst.com
Sat, 11 Feb 2023 19:56:27 -0500
1 files changed,
2 insertions(+),
1 deletions(-)
jump to
M
hoot.go
→
hoot.go
@@ -26,6 +26,7 @@
"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 @@ alt := htfilter.GetAttr(node, "alt")
if htfilter.HasClass(node, "Emoji") && alt != "" { return alt } - return fmt.Sprintf(" <img src='%s' alt='%s'>", htfilter.GetAttr(node, "src"), alt) + return string(templates.Sprintf(" <img src='%s' alt='%s'>", htfilter.GetAttr(node, "src"), alt)) } var buf strings.Builder