File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 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() {
3434 return this . connectionPromise ;
3535 }
3636
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+ }
3741 var usernameStart = this . mongoURI . indexOf ( '://' ) + 3 ;
3842 var lastAtIndex = this . mongoURI . lastIndexOf ( '@' ) ;
3943 var encodedMongoURI = this . mongoURI ;
40- var username = null ;
41- var password = null ;
42- var split = null
44+ var split = null ;
4345 if ( lastAtIndex > 0 ) {
4446 split = this . mongoURI . slice ( usernameStart , lastAtIndex ) . split ( ':' ) ;
4547 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