From 18924eb2400dac02e3309aba98f507db39227720 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Sat, 15 Jul 2017 16:22:43 +0100 Subject: [PATCH] Save url for later, port_arg might be an object --- lib/createClient.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/createClient.js b/lib/createClient.js index a019fc7a38..2f3b09fdb3 100644 --- a/lib/createClient.js +++ b/lib/createClient.js @@ -23,7 +23,8 @@ module.exports = function createClient (port_arg, host_arg, options) { } else if (typeof port_arg === 'string' || port_arg && port_arg.url) { options = utils.clone(port_arg.url ? port_arg : host_arg || options); - var parsed = URL.parse(port_arg.url || port_arg, true, true); + var url = port_arg.url || port_arg; + var parsed = URL.parse(url, true, true); // [redis:]//[[user][:password]@][host][:port][/db-number][?db=db-number[&password=bar[&option=value]]] if (parsed.slashes) { // We require slashes @@ -59,7 +60,7 @@ module.exports = function createClient (port_arg, host_arg, options) { } else if (parsed.hostname) { throw new RangeError('The redis url must begin with slashes "//" or contain slashes after the redis protocol'); } else { - options.path = port_arg; + options.path = url; } } else if (typeof port_arg === 'object' || port_arg === undefined) {