Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 0ddf8f5

Browse files
committed
Fixed SCP regex
URLs should be user@server:port/path instead of user@server:port:path
1 parent 04765bb commit 0ddf8f5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

plumbing/transport/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func (e *fileEndpoint) String() string { return e.path }
227227

228228
var (
229229
isSchemeRegExp = regexp.MustCompile(`^[^:]+://`)
230-
scpLikeUrlRegExp = regexp.MustCompile(`^(?:(?P<user>[^@]+)@)?(?P<host>[^:\s]+):(?:(?P<port>[0-9]+):)?(?P<path>[^\\].*)$`)
230+
scpLikeUrlRegExp = regexp.MustCompile(`^(?:(?P<user>[^@]+)@)?(?P<host>[^:\s]+):(?:(?P<port>[0-9]{1,5})/)?(?P<path>[^\\].*)$`)
231231
)
232232

233233
func parseSCPLike(endpoint string) (Endpoint, bool) {

plumbing/transport/common_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (s *SuiteCommon) TestNewEndpointSCPLike(c *C) {
7575
}
7676

7777
func (s *SuiteCommon) TestNewEndpointSCPLikeWithPort(c *C) {
78-
e, err := NewEndpoint("[email protected]:9999:user/repository.git")
78+
e, err := NewEndpoint("[email protected]:9999/user/repository.git")
7979
c.Assert(err, IsNil)
8080
c.Assert(e.Protocol(), Equals, "ssh")
8181
c.Assert(e.User(), Equals, "git")

0 commit comments

Comments
 (0)