From 1baf90e7d425c53c4aac7f7065097a90159e364d Mon Sep 17 00:00:00 2001 From: tgfjt Date: Tue, 31 Oct 2017 16:25:15 +0900 Subject: [PATCH 1/2] show messsage if invalid dir name on createDir --- src/commands/clone.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commands/clone.js b/src/commands/clone.js index c28161b0..f7199fd4 100644 --- a/src/commands/clone.js +++ b/src/commands/clone.js @@ -92,6 +92,9 @@ function clone (opts) { // Create the directory if it doesn't exist // If no dir is specified, we put dat in a dir with name = key if (!opts.dir) opts.dir = key + if (!Buffer.isBuffer(opts.dir) || typeof opts.dir !== 'string') { + return bus.emit('exit:error', 'Directory path must be a string or Buffer') + } fs.access(opts.dir, fs.F_OK, function (err) { if (!err) { createdDirectory = false From 8eff6ec4c4568e978420b26353e45a63a5964826 Mon Sep 17 00:00:00 2001 From: Joe Hand Date: Tue, 27 Mar 2018 15:32:29 -0700 Subject: [PATCH 2/2] change or to and, fix tests --- src/commands/clone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/clone.js b/src/commands/clone.js index f7199fd4..81e44718 100644 --- a/src/commands/clone.js +++ b/src/commands/clone.js @@ -92,7 +92,7 @@ function clone (opts) { // Create the directory if it doesn't exist // If no dir is specified, we put dat in a dir with name = key if (!opts.dir) opts.dir = key - if (!Buffer.isBuffer(opts.dir) || typeof opts.dir !== 'string') { + if (!Buffer.isBuffer(opts.dir) && typeof opts.dir !== 'string') { return bus.emit('exit:error', 'Directory path must be a string or Buffer') } fs.access(opts.dir, fs.F_OK, function (err) {