Skip to content

Commit

Permalink
Merge pull request #35 from BorntraegerMarc/master
Browse files Browse the repository at this point in the history
fix: allow special chars in password or user string
  • Loading branch information
wzrdtales authored Oct 3, 2018
2 parents 1ff0509 + 41c5ce9 commit f69e3df
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ exports.connect = function(config, intern, callback) {
var mongoString = 'mongodb://';

if(config.user !== undefined && config.password !== undefined) {
// Ensure user and password can contain special characters like "@" so app doesn't throw an exception when connecting to MongoDB
config.user = encodeURIComponent(config.user);
config.password = encodeURIComponent(config.password);

mongoString += config.user + ':' + config.password + '@';
}

Expand Down

0 comments on commit f69e3df

Please sign in to comment.