Skip to content

Commit

Permalink
fix(url parser): only check for multiple hostnames with srv protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Lord committed Nov 20, 2017
1 parent b660ae5 commit 5542bcc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/url_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ module.exports = function(url, options, callback) {
return callback(new Error('invalid schema, expected mongodb or mongodb+srv'));
}

if (result.pathname && result.pathname.match(',')) {
// Cannot use multiple hostnames
return callback(new Error('invalid uri, cannot contain multiple hostnames'));
}

if (result.protocol === 'mongodb+srv:') {
if (result.pathname && result.pathname.match(',')) {
return callback(new Error('invalid uri, cannot contain multiple hostnames'));
}

if (result.port) {
return callback(new Error('Ports not accepted with mongodb+srv'));
}
Expand Down

0 comments on commit 5542bcc

Please sign in to comment.