File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ function parse(str) {
47
47
48
48
var auth = ( result . auth || ':' ) . split ( ':' ) ;
49
49
config . user = auth [ 0 ] ;
50
- config . password = auth [ 1 ] ;
50
+ config . password = auth . splice ( 1 ) . join ( ':' ) ;
51
51
52
52
var ssl = result . query . ssl ;
53
53
if ( ssl === 'true' || ssl === '1' ) {
Original file line number Diff line number Diff line change @@ -69,6 +69,20 @@ test('password contains < and/or > characters', function(t){
69
69
t . end ( ) ;
70
70
} ) ;
71
71
72
+ test ( 'password contains colons' , function ( t ) {
73
+ var sourceConfig = {
74
+ user :'brian' ,
75
+ password : 'hello:pass:world' ,
76
+ port : 5432 ,
77
+ host : 'localhost' ,
78
+ database : 'postgres'
79
+ } ;
80
+ var connectionString = 'postgres://' + sourceConfig . user + ':' + sourceConfig . password + '@' + sourceConfig . host + ':' + sourceConfig . port + '/' + sourceConfig . database ;
81
+ var subject = parse ( connectionString ) ;
82
+ t . equal ( subject . password , sourceConfig . password ) ;
83
+ t . end ( ) ;
84
+ } ) ;
85
+
72
86
test ( 'username or password contains weird characters' , function ( t ) {
73
87
var strang = 'pg://my f%irst name:is&%awesome!@localhost:9000' ;
74
88
var subject = parse ( strang ) ;
You can’t perform that action at this time.
0 commit comments