fix host extraction from actors without paths

This commit is contained in:
Ted Unangst 2019-06-14 16:32:10 -04:00
parent 1af6a3a70b
commit f65e89dbac
1 changed files with 3 additions and 2 deletions

5
fun.go
View File

@ -311,10 +311,11 @@ func mentionize(s string) string {
}
var re_unurl = regexp.MustCompile("https://([^/]+).*/([^/]+)")
var re_urlhost = regexp.MustCompile("https://([^/]+)")
func originate(u string) string {
m := re_unurl.FindStringSubmatch(u)
if len(m) > 2 {
m := re_urlhost.FindStringSubmatch(u)
if len(m) > 1 {
return m[1]
}
return ""