From 4c66260eecfecc531c526df40881ef51cf82ef46 Mon Sep 17 00:00:00 2001 From: James Mills Date: Mon, 26 Sep 2016 23:21:56 +1000 Subject: Don't include :port if the server is onthe default port 70 --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index d1557f6..913b0a2 100644 --- a/main.go +++ b/main.go @@ -44,10 +44,16 @@ func renderDirectory(w http.ResponseWriter, tpl *template.Template, hostport str if strings.HasPrefix(x.Selector, "URL:") { tr.Link = template.URL(x.Selector[4:]) } else { + var hostport string + if x.Port == 70 { + hostport = x.Host + } else { + hostport = fmt.Sprintf("%s:%d", x.Host, x.Port) + } tr.Link = template.URL( fmt.Sprintf( "/%s/%s%s", - fmt.Sprintf("%s:%d", x.Host, x.Port), + hostport, string(byte(x.Type)), url.QueryEscape(x.Selector), ), -- cgit v1.2.3-54-g00ecf