File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,19 @@ ExportAdapter.prototype.connect = function() {
34
34
return this . connectionPromise ;
35
35
}
36
36
37
+ var usernameStart = this . mongoURI . indexOf ( '://' ) + 3 ;
38
+ var lastAtIndex = this . mongoURI . lastIndexOf ( '@' ) ;
39
+ var encodedMongoURI = this . mongoURI ;
40
+ var username = null ;
41
+ var password = null ;
42
+ var split = null
43
+ if ( lastAtIndex > 0 ) {
44
+ split = this . mongoURI . slice ( usernameStart , lastAtIndex ) . split ( ':' ) ;
45
+ encodedMongoURI = this . mongoURI . slice ( 0 , usernameStart ) + encodeURIComponent ( split [ 0 ] ) + ':' + encodeURIComponent ( split [ 1 ] ) + this . mongoURI . slice ( lastAtIndex ) ;
46
+ }
47
+
37
48
this . connectionPromise = Promise . resolve ( ) . then ( ( ) => {
38
- return MongoClient . connect ( this . mongoURI ) ;
49
+ return MongoClient . connect ( encodedMongoURI , { uri_decode_auth : true } ) ;
39
50
} ) . then ( ( db ) => {
40
51
this . db = db ;
41
52
} ) ;
You can’t perform that action at this time.
0 commit comments