utils_sanitise.go: strip protocol before trailer
Fixes https://gitlab.com/commento/commento/issues/176
This commit is contained in:
parent
162b11bd7a
commit
3101af8a5c
@ -18,13 +18,13 @@ func emailStrip(email string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var https = regexp.MustCompile(`(https?://)`)
|
var https = regexp.MustCompile(`(https?://)`)
|
||||||
var trailingSlash = regexp.MustCompile(`(/*$)`)
|
var domainTrail = regexp.MustCompile(`(/.*$)`)
|
||||||
|
|
||||||
func domainStrip(domain string) string {
|
func domainStrip(domain string) string {
|
||||||
noSlash := trailingSlash.ReplaceAllString(domain, ``)
|
noProtocol := https.ReplaceAllString(domain, ``)
|
||||||
noProtocol := https.ReplaceAllString(noSlash, ``)
|
noTrail := domainTrail.ReplaceAllString(noProtocol, ``)
|
||||||
|
|
||||||
return noProtocol
|
return noTrail
|
||||||
}
|
}
|
||||||
|
|
||||||
var pathMatch = regexp.MustCompile(`(https?://[^/]*)`)
|
var pathMatch = regexp.MustCompile(`(https?://[^/]*)`)
|
||||||
|
Loading…
Reference in New Issue
Block a user