|
@@ -343,8 +343,10 @@ module.exports = class XHRUpload extends BasePlugin {
|
|
|
reject(new Error('File removed'))
|
|
|
})
|
|
|
|
|
|
- this.onCancelAll(file.id, () => {
|
|
|
- queuedRequest.abort()
|
|
|
+ this.onCancelAll(file.id, ({ reason }) => {
|
|
|
+ if (reason === 'user') {
|
|
|
+ queuedRequest.abort()
|
|
|
+ }
|
|
|
reject(new Error('Upload cancelled'))
|
|
|
})
|
|
|
})
|
|
@@ -388,9 +390,11 @@ module.exports = class XHRUpload extends BasePlugin {
|
|
|
resolve(`upload ${file.id} was removed`)
|
|
|
})
|
|
|
|
|
|
- this.onCancelAll(file.id, () => {
|
|
|
- socket.send('cancel', {})
|
|
|
- queuedRequest.abort()
|
|
|
+ this.onCancelAll(file.id, ({ reason } = {}) => {
|
|
|
+ if (reason === 'user') {
|
|
|
+ socket.send('cancel', {})
|
|
|
+ queuedRequest.abort()
|
|
|
+ }
|
|
|
resolve(`upload ${file.id} was canceled`)
|
|
|
})
|
|
|
|
|
@@ -528,7 +532,8 @@ module.exports = class XHRUpload extends BasePlugin {
|
|
|
return reject(error)
|
|
|
})
|
|
|
|
|
|
- this.uppy.on('cancel-all', () => {
|
|
|
+ this.uppy.on('cancel-all', ({ reason } = {}) => {
|
|
|
+ if (reason !== 'user') return
|
|
|
timer.done()
|
|
|
xhr.abort()
|
|
|
})
|
|
@@ -590,10 +595,10 @@ module.exports = class XHRUpload extends BasePlugin {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- onCancelAll (fileID, cb) {
|
|
|
- this.uploaderEvents[fileID].on('cancel-all', () => {
|
|
|
+ onCancelAll (fileID, eventHandler) {
|
|
|
+ this.uploaderEvents[fileID].on('cancel-all', (...args) => {
|
|
|
if (!this.uppy.getFile(fileID)) return
|
|
|
- cb()
|
|
|
+ eventHandler(...args)
|
|
|
})
|
|
|
}
|
|
|
|