Strip port from gogs netrc file

This commit is contained in:
Brad Rydzewski 2015-12-24 10:09:18 -05:00
parent 247aadf84b
commit 32cdf41ce7

View file

@ -2,6 +2,7 @@ package gogs
import (
"fmt"
"net"
"net/http"
"net/url"
"strconv"
@ -179,6 +180,10 @@ func (g *Gogs) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error) {
if err != nil {
return nil, err
}
host, _, err := net.SplitHostPort(url_.Host)
if err == nil {
url_.Host=host
}
return &model.Netrc{
Login: u.Token,
Password: "x-oauth-basic",