Skip to content

@uppy/s3: import each file from the bucket it was listed in - #6853

Open
qxprakash wants to merge 2 commits into
mainfrom
fix/s3-bucket-per-file
Open

qxprakash wants to merge 2 commits into
mainfrom
fix/s3-bucket-per-file

Conversation

@qxprakash

@qxprakash qxprakash commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

@uppy/s3: a selected file could be imported from the wrong bucket.

fileUrl() runs when the selected files are added (on Done), and pinned the bucket that the most recent listing returned. If a later listing returned a different bucket before Done, files listed in the first bucket were imported with the second bucket's name. The plugin now remembers the bucket of each listed item when the listing arrives, and fileUrl() uses that; logout clears it. The old single #bucket field is gone.

Files are identified by their key, so if one session lists the same key in two different buckets, the selection can't tell which one was picked. Such a file is now refused ("log out and select it again") instead of being imported from whichever bucket listed it last.

Tests

  • A file keeps the bucket it was listed in when a later listing returns another one, and a key listed in two buckets is refused (both fail without the fix).
  • @uppy/s3 and @uppy/transloadit-storage suites pass; types and Biome clean.

🤖 Generated with Claude Code

fileUrl() runs when files are added, and pinned the bucket of the latest
listing, so a file listed in one bucket could be imported from another
after a later listing reported a different one. The bucket is now
remembered per listed item.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T20:33:25.299392Z
We couldn’t complete this review. Comment @codex review to try again.
3e1e8ba PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@changeset-bot

changeset-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0385b47

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@uppy/s3 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Files are identified by key only, so when a session sees the same key in
two buckets, the selection can't say which one the user picked. Refuse it
instead of importing from whichever bucket listed it last.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The picker throws a plain Error that is only logged, so clicking Done adds no files and hides the logout instruction users need to recover.

1 open issue
What changed in this PR

This PR fixes S3 imports using the wrong bucket after a later listing changes the session’s bucket.

Changes:

  • Tracks the bucket for each listed file and clears that tracking on logout.
  • Rejects keys listed in multiple buckets rather than choosing an ambiguous source.
  • Adds regression coverage and a patch changeset.
File Description
packages/​@uppy/​s3/​test/​S3.browser.test.tsx Tests per-file bucket retention and ambiguous-key rejection.
packages/​@uppy/​s3/​src/​S3.tsx Replaces the shared bucket field with per-path tracking.
.changeset/​s3-bucket-per-file.md Documents the fix for an @uppy/s3 patch release.

Review effort: Balanced

if (!this.#bucket)
const bucket = this.#bucketByPath.get(id)
if (bucket === null)
throw new Error(

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants