pass flow tests

This commit is contained in:
ansuz 2018-03-16 12:26:39 +01:00
parent e56d762409
commit 5b21911341
1 changed files with 6 additions and 1 deletions

7
rpc.js
View File

@ -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]);