Skip to content

Commit

Permalink
fix(url-parser): bail early on validation when using domain socket
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Aug 24, 2018
1 parent 93d01e1 commit 3cb3da3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/url_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ function parseConnectionString(url, options) {

for (let i = 0; i < hosts.length; i++) {
let r = parser.parse(f('mongodb://%s', hosts[i].trim()));
if (r.path && r.path.indexOf('.sock') !== -1) continue;
if (r.path && r.path.indexOf(':') !== -1) {
// Not connecting to a socket so check for an extra slash in the hostname.
// Using String#split as perf is better than match.
Expand Down

0 comments on commit 3cb3da3

Please sign in to comment.