Skip to content

Commit 5542bcc

Browse files
author
Jessica Lord
committed
fix(url parser): only check for multiple hostnames with srv protocol
1 parent b660ae5 commit 5542bcc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/url_parser.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ module.exports = function(url, options, callback) {
1313
return callback(new Error('invalid schema, expected mongodb or mongodb+srv'));
1414
}
1515

16-
if (result.pathname && result.pathname.match(',')) {
17-
// Cannot use multiple hostnames
18-
return callback(new Error('invalid uri, cannot contain multiple hostnames'));
19-
}
20-
2116
if (result.protocol === 'mongodb+srv:') {
17+
if (result.pathname && result.pathname.match(',')) {
18+
return callback(new Error('invalid uri, cannot contain multiple hostnames'));
19+
}
20+
2221
if (result.port) {
2322
return callback(new Error('Ports not accepted with mongodb+srv'));
2423
}

0 commit comments

Comments
 (0)