From c0044b90d4cd59f61cc3dd8b753903b72843b848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 8 Jun 2017 13:11:20 +0200 Subject: [PATCH 1/2] tus: return immediately if no files are selected, fixes #214 --- src/plugins/Tus10.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/Tus10.js b/src/plugins/Tus10.js index 415589795..c5dd0ed10 100644 --- a/src/plugins/Tus10.js +++ b/src/plugins/Tus10.js @@ -281,11 +281,6 @@ module.exports = class Tus10 extends Plugin { } uploadFiles (files) { - if (Object.keys(files).length === 0) { - this.core.log('no files to upload!') - return - } - files.forEach((file, index) => { const current = parseInt(index, 10) + 1 const total = files.length @@ -299,6 +294,11 @@ module.exports = class Tus10 extends Plugin { } handleUpload (fileIDs) { + if (fileIDs.length === 0) { + this.core.log('Tus: no files to upload!') + return Promise.resolve() + } + this.core.log('Tus is uploading...') const filesToUpload = fileIDs.map(getFile, this) function getFile (fileID) { From 38c91c929632c2b748fec982cb6cc7597dc260c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Sun, 9 Jul 2017 14:25:47 +0200 Subject: [PATCH 2/2] multipart: Resolve immediately if no files are selected --- src/plugins/Multipart.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/Multipart.js b/src/plugins/Multipart.js index 01f45ec8c..11fda5533 100644 --- a/src/plugins/Multipart.js +++ b/src/plugins/Multipart.js @@ -145,11 +145,6 @@ module.exports = class Multipart extends Plugin { } selectForUpload (files) { - if (Object.keys(files).length === 0) { - this.core.log('no files to upload!') - return - } - files.forEach((file, i) => { const current = parseInt(i, 10) + 1 const total = files.length @@ -171,6 +166,11 @@ module.exports = class Multipart extends Plugin { } handleUpload (fileIDs) { + if (fileIDs.length === 0) { + this.core.log('Multipart: no files to upload!') + return Promise.resolve() + } + this.core.log('Multipart is uploading...') const files = fileIDs.map(getFile, this) function getFile (fileID) {