From 3cb3da32331db36c8433fc0c2221b0c1f79995e8 Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Tue, 21 Aug 2018 18:51:10 -0400 Subject: [PATCH] fix(url-parser): bail early on validation when using domain socket --- lib/url_parser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/url_parser.js b/lib/url_parser.js index 8ced4f11b1..7cc0b2f293 100644 --- a/lib/url_parser.js +++ b/lib/url_parser.js @@ -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.