fix incomplete unowned file upload

pull/1/head
ansuz 4 years ago
parent f5908e5f57
commit 4316264044

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

Loading…
Cancel
Save