mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-22 09:48:06 +00:00
tus: clear uploadURL when retrying.
This commit is contained in:
parent
d7557bd13d
commit
e56dc21faa
1 changed files with 16 additions and 4 deletions
|
|
@ -126,13 +126,11 @@ module.exports = class Tus10 extends Plugin {
|
|||
})
|
||||
|
||||
this.onRetry(file.id, () => {
|
||||
upload.abort()
|
||||
upload.start()
|
||||
this.removeUploadURL(file.id)
|
||||
})
|
||||
|
||||
this.onRetryAll(file.id, () => {
|
||||
upload.abort()
|
||||
upload.start()
|
||||
this.removeUploadURL(file.id)
|
||||
})
|
||||
|
||||
this.onPauseAll(file.id, () => {
|
||||
|
|
@ -141,6 +139,7 @@ module.exports = class Tus10 extends Plugin {
|
|||
|
||||
this.onCancelAll(file.id, () => {
|
||||
upload.abort()
|
||||
this.removeUploadURL(file.id)
|
||||
})
|
||||
|
||||
this.onResumeAll(file.id, () => {
|
||||
|
|
@ -265,6 +264,19 @@ module.exports = class Tus10 extends Plugin {
|
|||
}
|
||||
}
|
||||
|
||||
removeUploadURL (fileID) {
|
||||
const file = this.core.getFile(fileID)
|
||||
|
||||
// No need to change state if we didn't have an `uploadUrl`.
|
||||
if (!file || !file.tus || !file.tus.uploadUrl) return
|
||||
|
||||
this.updateFile(Object.assign({}, file, {
|
||||
tus: Object.assign({}, file.tus, {
|
||||
uploadUrl: null
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
onFileRemove (fileID, cb) {
|
||||
this.core.on('core:file-removed', (targetFileID) => {
|
||||
if (fileID === targetFileID) cb(targetFileID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue