Merge pull request #245 from goto-bus-stop/tus-no-files

tus: return immediately if no files are selected, fixes #214
This commit is contained in:
Artur Paikin 2017-07-11 16:48:46 +02:00 committed by GitHub
commit bbd94f993c
2 changed files with 10 additions and 10 deletions

View file

@ -151,11 +151,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
@ -177,6 +172,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) {

View file

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