From d21e5941fb4dab3b9de31d06e2e7cb2ae239f158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Mon, 4 Dec 2017 11:41:16 +0100 Subject: [PATCH] tus: Start paused when restoring a paused upload. --- src/plugins/Tus.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/Tus.js b/src/plugins/Tus.js index 5b0e5b010..5379dc929 100644 --- a/src/plugins/Tus.js +++ b/src/plugins/Tus.js @@ -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) => {