Skip to content

Commit

Permalink
fix url regex (support go4.org repository)
Browse files Browse the repository at this point in the history
  • Loading branch information
faceair committed Oct 13, 2018
1 parent b4b54a3 commit faa927d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/faceair/betproxy"
)

var urlRegex = regexp.MustCompile(`([A-Za-z0-9_.-]+(/[A-Za-z0-9_.-]+)+?)(/info/refs|/git-upload-pack|\?go-get=1)`)
var urlRegex = regexp.MustCompile(`([A-Za-z0-9_.-]+((/[A-Za-z0-9_.-]+)+?)?)/?(/info/refs|/git-upload-pack|\?go-get=1)`)
var repoRegex = regexp.MustCompile(`content="(.+?) git (.+)?"`)

// NewServer create a Server instance
Expand Down Expand Up @@ -51,7 +51,7 @@ func (g *Server) Do(req *http.Request) (*http.Response, error) {
}

repoPath := match[1]
urlPath := match[3]
urlPath := match[4]

header := http.Header{
"Expires": []string{"Fri, 01 Jan 1980 00:00:00 GMT"},
Expand Down

0 comments on commit faa927d

Please sign in to comment.