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() {
3434 return this . connectionPromise ;
3535 }
3636
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+
3748 this . connectionPromise = Promise . resolve ( ) . then ( ( ) => {
38- return MongoClient . connect ( this . mongoURI ) ;
49+ return MongoClient . connect ( encodedMongoURI , { uri_decode_auth : true } ) ;
3950 } ) . then ( ( db ) => {
4051 this . db = db ;
4152 } ) ;
You can’t perform that action at this time.
0 commit comments