Skip to content

Commit c1aa681

Browse files
author
Jessica Lord
committed
fix(url parser): error when multiple hostnames used
1 parent 6096afc commit c1aa681

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/url_parser.js

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +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+
1621
if (result.protocol === 'mongodb+srv:') {
1722
if (result.port) {
1823
return callback(new Error('Ports not accepted with mongodb+srv'));

0 commit comments

Comments
 (0)