This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -128,10 +128,10 @@ func (u *Endpoint) String() string {
128128 buf .WriteString ("//" )
129129
130130 if u .User != "" || u .Password != "" {
131- buf .WriteString (u .User )
131+ buf .WriteString (url . PathEscape ( u .User ) )
132132 if u .Password != "" {
133133 buf .WriteByte (':' )
134- buf .WriteString (u .Password )
134+ buf .WriteString (url . PathEscape ( u .Password ) )
135135 }
136136
137137 buf .WriteByte ('@' )
Original file line number Diff line number Diff line change 11package transport
22
33import (
4+ "net/url"
45 "testing"
56
67 "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
@@ -153,6 +154,15 @@ func (s *SuiteCommon) TestNewEndpointFileURL(c *C) {
153154 c .Assert (e .String (), Equals , "file:///foo.git" )
154155}
155156
157+ func (s * SuiteCommon ) TestValidEndpoint (c * C ) {
158+ e , err := NewEndpoint ("http://github.com/user/repository.git" )
159+ e .User = "person@mail.com"
160+ e .Password = " !\" #$%&'()*+,-./:;<=>?@[\\ ]^_`{|}~"
161+ url , err := url .Parse (e .String ())
162+ c .Assert (err , IsNil )
163+ c .Assert (url , NotNil )
164+ }
165+
156166func (s * SuiteCommon ) TestNewEndpointInvalidURL (c * C ) {
157167 e , err := NewEndpoint ("http://\\ " )
158168 c .Assert (err , NotNil )
You can’t perform that action at this time.
0 commit comments