tus: Start paused when restoring a paused upload.

This commit is contained in:
Renée Kooi 2017-12-04 11:41:16 +01:00
parent 166babea2e
commit d21e5941fb
No known key found for this signature in database
GPG key ID: 30516CF2A8E63718

View file

@ -171,7 +171,11 @@ module.exports = class Tus extends Plugin {
})
this.onPause(file.id, (isPaused) => {
isPaused ? upload.abort() : upload.start()
if (isPaused) {
upload.abort()
} else {
upload.start()
}
})
this.onPauseAll(file.id, () => {
@ -189,7 +193,10 @@ module.exports = class Tus extends Plugin {
upload.start()
})
upload.start()
if (!file.isPaused) {
upload.start()
}
this.core.emit('core:upload-started', file.id, upload)
})
}
@ -275,6 +282,10 @@ module.exports = class Tus extends Plugin {
socket.send('resume', {})
})
if (file.isPaused) {
socket.send('pause', {})
}
socket.on('progress', (progressData) => emitSocketProgress(this, progressData, file))
socket.on('success', (data) => {