From 5b21911341744a5cdef9743f754f049adaef03af Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 16 Mar 2018 12:26:39 +0100 Subject: [PATCH] pass flow tests --- rpc.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rpc.js b/rpc.js index 3ad1a9a42..9cdb440f3 100644 --- a/rpc.js +++ b/rpc.js @@ -992,6 +992,9 @@ var owned_upload_complete = function (Env, safeKey, cb) { } var oldPath = makeFilePath(Env.paths.staging, safeKey); + if (typeof(oldPath) !== 'string') { + return void cb('EINVAL_CONFIG'); + } // construct relevant paths var root = Env.paths.staging; @@ -1054,6 +1057,9 @@ var owned_upload_complete = function (Env, safeKey, cb) { })); }).nThen(function (w) { // move the existing file to its new path + + // flow is dumb and I need to guard against this which will never happen + /*:: if (typeof(oldPath) === 'object') { throw new Error('should never happen'); } */ Fs.rename(oldPath /* XXX */, finalPath, w(function (e) { if (e) { w.abort(); @@ -1217,7 +1223,6 @@ RPC.create = function ( var pinPath = paths.pin = keyOrDefaultString('pinPath', './pins'); var blobPath = paths.blob = keyOrDefaultString('blobPath', './blob'); var blobStagingPath = paths.staging = keyOrDefaultString('blobStagingPath', './blobstage'); - console.log(blobStagingPath); var isUnauthenticateMessage = function (msg) { return msg && msg.length === 2 && isUnauthenticatedCall(msg[0]);