Skip to content

Commit

Permalink
@uppy/core: do not crash if a file is removed before the upload starts (
Browse files Browse the repository at this point in the history
#4148)

(cherry picked from commit 33beeab)
  • Loading branch information
aduh95 committed Oct 19, 2022
1 parent c228398 commit dad38c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/@uppy/aws-s3/src/MiniXHRUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ export default class MiniXHRUpload {
}
const serverToken = await this.#queueRequestSocketToken(file)

if (this.getState().files[file.id]) return undefined

this.uppy.setFileState(file.id, { serverToken })
return this.connectToServerSocket(this.uppy.getFile(file.id))
} catch (err) {
Expand Down
2 changes: 2 additions & 0 deletions packages/@uppy/tus/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ export default class Tus extends BasePlugin {
}
const serverToken = await this.#queueRequestSocketToken(file)

if (this.getState().files[file.id]) return undefined

this.uppy.setFileState(file.id, { serverToken })
return this.connectToServerSocket(this.uppy.getFile(file.id))
} catch (err) {
Expand Down

0 comments on commit dad38c5

Please sign in to comment.