diff options
-rw-r--r-- | main.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -44,10 +44,16 @@ func renderDirectory(w http.ResponseWriter, tpl *template.Template, hostport str | |||
44 | if strings.HasPrefix(x.Selector, "URL:") { | 44 | if strings.HasPrefix(x.Selector, "URL:") { |
45 | tr.Link = template.URL(x.Selector[4:]) | 45 | tr.Link = template.URL(x.Selector[4:]) |
46 | } else { | 46 | } else { |
47 | var hostport string | ||
48 | if x.Port == 70 { | ||
49 | hostport = x.Host | ||
50 | } else { | ||
51 | hostport = fmt.Sprintf("%s:%d", x.Host, x.Port) | ||
52 | } | ||
47 | tr.Link = template.URL( | 53 | tr.Link = template.URL( |
48 | fmt.Sprintf( | 54 | fmt.Sprintf( |
49 | "/%s/%s%s", | 55 | "/%s/%s%s", |
50 | fmt.Sprintf("%s:%d", x.Host, x.Port), | 56 | hostport, |
51 | string(byte(x.Type)), | 57 | string(byte(x.Type)), |
52 | url.QueryEscape(x.Selector), | 58 | url.QueryEscape(x.Selector), |
53 | ), | 59 | ), |