Skip to content

Commit

Permalink
Fix userinfo part of regexp (#20)
Browse files Browse the repository at this point in the history
Unless I'm misreading rfc3986, the userinfo can contain:
ALPHA / DIGIT / "-" / "." / "_" / "~"

Github orgs are of the form "org-########", which is what I'm personally needing
to parse.
  • Loading branch information
alokmenghrajani authored Sep 17, 2020
1 parent 73f16f3 commit 4a18977
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (

var (
// scpSyntax was modified from https://golang.org/src/cmd/go/vcs.go.
scpSyntax = regexp.MustCompile(`^([a-zA-Z0-9_]+@)?([a-zA-Z0-9._-]+):([a-zA-Z0-9./._-]+)(?:\?||$)(.*)$`)
scpSyntax = regexp.MustCompile(`^([a-zA-Z0-9-._~]+@)?([a-zA-Z0-9._-]+):([a-zA-Z0-9./._-]+)(?:\?||$)(.*)$`)

// Transports is a set of known Git URL schemes.
Transports = NewTransportSet(
Expand Down
5 changes: 5 additions & 0 deletions urls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ func init() {
"https", "user:password", "host.xz", "/organization/repo.git",
"", "ref=feature/test",
),
NewTest(
"[email protected]:path/to/repo.git/",
"ssh", "user-1234", "host.xz", "path/to/repo.git/",
"ssh://[email protected]/path/to/repo.git/", "",
),
}
}

Expand Down

0 comments on commit 4a18977

Please sign in to comment.