From 431626404484fa35c943c56851c1a3830bcf302e Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 19 Feb 2021 13:12:35 +0530 Subject: [PATCH] fix incomplete unowned file upload --- lib/commands/upload.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/commands/upload.js b/lib/commands/upload.js index 346262716..5d0c8740b 100644 --- a/lib/commands/upload.js +++ b/lib/commands/upload.js @@ -75,19 +75,18 @@ Upload.upload = function (Env, safeKey, chunk, cb) { Env.blobStore.upload(safeKey, chunk, cb); }; -Upload.complete = function (Env, safeKey, arg, cb) { - Env.blobStore.closeBlobstage(safeKey); - Env.completeUpload(safeKey, arg, false, cb); -}; - Upload.cancel = function (Env, safeKey, arg, cb) { Env.blobStore.cancel(safeKey, arg, cb); }; -Upload.complete_owned = function (Env, safeKey, arg, cb) { - Env.blobStore.closeBlobstage(safeKey); - var user = Core.getSession(Env.Sessions, safeKey); - var size = user.pendingUploadSize; - Env.completeUpload(safeKey, arg, true, size, cb); +var completeUpload = function (owned) { + return function (Env, safeKey, arg, cb) { + Env.blobStore.closeBlobstage(safeKey); + var user = Core.getSession(Env.Sessions, safeKey); + var size = user.pendingUploadSize; + Env.completeUpload(safeKey, arg, Boolean(owned), size, cb); + }; }; +Upload.complete = completeUpload(false); +Upload.complete_owned = completeUpload(true);