From 192a517e64fc8a0992e4f52f1c11d3a5f2b5ebe5 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 8 Jun 2017 14:02:26 +0200 Subject: [PATCH] handle nonexistent files in getUploadSize --- rpc.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpc.js b/rpc.js index 7057028e2..1ba8bb80b 100644 --- a/rpc.js +++ b/rpc.js @@ -276,7 +276,11 @@ var getUploadSize = function (Env, channel, cb) { } Fs.stat(path, function (err, stats) { - if (err) { return void cb(err); } + if (err) { + // if a file was deleted, its size is 0 bytes + if (err.code === 'ENOENT') { return cb(void 0, 0); } + return void cb(err); + } cb(void 0, stats.size); }); };