normalize image urls

This commit is contained in:
Ted Unangst 2019-11-10 23:49:09 -05:00
parent 177d72c265
commit 4fc4b67f91
3 changed files with 6 additions and 3 deletions

3
fun.go
View File

@ -24,6 +24,7 @@ import (
"io" "io"
"log" "log"
"net/http" "net/http"
"net/url"
"os" "os"
"regexp" "regexp"
"strings" "strings"
@ -95,6 +96,7 @@ func reverbolate(userid int64, honks []*Honk) {
var htf htfilter.Filter var htf htfilter.Filter
htf.Imager = replaceimgsand(zap, false) htf.Imager = replaceimgsand(zap, false)
htf.SpanClasses = allowedclasses htf.SpanClasses = allowedclasses
htf.BaseURL, _ = url.Parse(h.XID)
p, _ := htf.String(h.Precis) p, _ := htf.String(h.Precis)
n, _ := htf.String(h.Noise) n, _ := htf.String(h.Noise)
h.Precis = string(p) h.Precis = string(p)
@ -183,6 +185,7 @@ func inlineimgsfor(honk *Honk) func(node *html.Node) string {
func imaginate(honk *Honk) { func imaginate(honk *Honk) {
var htf htfilter.Filter var htf htfilter.Filter
htf.Imager = inlineimgsfor(honk) htf.Imager = inlineimgsfor(honk)
htf.BaseURL, _ = url.Parse(honk.XID)
htf.String(honk.Noise) htf.String(honk.Noise)
} }

2
go.mod
View File

@ -7,7 +7,7 @@ require (
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 golang.org/x/net v0.0.0-20190620200207-3b0461eec859
humungus.tedunangst.com/r/go-sqlite3 v1.1.3 humungus.tedunangst.com/r/go-sqlite3 v1.1.3
humungus.tedunangst.com/r/webs v0.6.24 humungus.tedunangst.com/r/webs v0.6.25
) )
go 1.11 go 1.11

4
go.sum
View File

@ -22,5 +22,5 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9ga8k38geUI= humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9ga8k38geUI=
humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M= humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M=
humungus.tedunangst.com/r/webs v0.6.24 h1:/Svffk8mEWXsb7RiKJ94g/FKi941C5pbRX6UKFc4bXs= humungus.tedunangst.com/r/webs v0.6.25 h1:Vq9P9q83al9RX/tKF5eZbZCu8BRseKgDe0AXXM7gltY=
humungus.tedunangst.com/r/webs v0.6.24/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps= humungus.tedunangst.com/r/webs v0.6.25/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=