Skip to content

Concurrent upload can start a batch's files before vault encryption and folder creation finish #4263

Closed

Description

@JammingBen

Bug Description

HandleUpload.handleUpload adds a batch's files to Uppy's state before preparing them, then awaits resolveVaultEngine, applyVaultEncryption and createDirectoryTree. Only after that does it call uppy.upload(). If another upload calls uppy.upload() during that time, Uppy uploads every file in its state, including the files of the batch that is still being prepared. This can happen with or without a conflict dialog.

The upload then starts too early:

  • Vault: the file is uploaded before it is encrypted, so the cleartext content and name can end up in the vault folder.
  • Folder uploads: files are uploaded before their parent folders exist, so the upload fails.

#4140 fixes this for the time the conflict dialog is open: the batch's files are held back from Uppy until the dialog is answered. This issue covers the window after that.

Reproduction Steps

Vault

  1. Open a folder inside a vault.
  2. Upload a large file, which makes encryption take a few seconds.
  3. While it is still being encrypted (before its progress shows up), drop a second small file.

Folder upload

  1. Upload a folder with a deep or wide tree, which makes folder creation take a while.
  2. While its folders are still being created, drop a single file into the current folder.

Expected Outcome

A batch's files are uploaded only after their own preparation is done (encrypted for vaults, parent folders created).

Actual Outcome

The second upload's uppy.upload() also uploads the first batch's unprepared files: cleartext into the vault, or into folders that don't exist yet, which fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions