feat: do not display port number if it matches protocol default port

This commit is contained in:
Tom Andrade 2022-05-18 15:12:47 +02:00
parent 2b31e08215
commit 272c2f1330
Signed by: wolvie
GPG Key ID: 31AAB07872E82669

View File

@ -214,7 +214,12 @@ func Short(t *template.Template) func(ctx *fasthttp.RequestCtx) {
})
return
}
ru, _ := url.Parse(fmt.Sprintf("%s://%s:%v/%s%s", Proto, Domain, Port, Path, suf))
var ru *url.URL
if (Proto == "http" && Port == 80) || (Proto == "https" && Port == 443) {
ru, _ = url.Parse(fmt.Sprintf("%s://%s/%s%s", Proto, Domain, Path, suf))
} else {
ru, _ = url.Parse(fmt.Sprintf("%s://%s:%v/%s%s", Proto, Domain, Port, Path, suf))
}
t.Execute(ctx, body{
IsLink: true,
Line1: ru.String(),