File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,14 @@ ExportAdapter.prototype.connect = function() {
34
34
return this . connectionPromise ;
35
35
}
36
36
37
+ //http://regexr.com/3cn6m
38
+ if ( ! this . mongoURI . match ( / ^ m o n g o d b : \/ \/ ( ( .+ ) : ( .+ ) @ ) ? ( [ ^ : @ ] + ) : ( [ ^ : ] + ) \/ ( .+ ?) $ / gm) ) {
39
+ throw new Error ( "Invalid mongoURI: " + this . mongoURI )
40
+ }
37
41
var usernameStart = this . mongoURI . indexOf ( '://' ) + 3 ;
38
42
var lastAtIndex = this . mongoURI . lastIndexOf ( '@' ) ;
39
43
var encodedMongoURI = this . mongoURI ;
40
- var username = null ;
41
- var password = null ;
42
- var split = null
44
+ var split = null ;
43
45
if ( lastAtIndex > 0 ) {
44
46
split = this . mongoURI . slice ( usernameStart , lastAtIndex ) . split ( ':' ) ;
45
47
encodedMongoURI = this . mongoURI . slice ( 0 , usernameStart ) + encodeURIComponent ( split [ 0 ] ) + ':' + encodeURIComponent ( split [ 1 ] ) + this . mongoURI . slice ( lastAtIndex ) ;
You can’t perform that action at this time.
0 commit comments