Skip to content

feat(content-uploader): update fields in uploads response#4592

Merged
mergify[bot] merged 4 commits into
masterfrom
feat-upload-fields
May 28, 2026
Merged

feat(content-uploader): update fields in uploads response#4592
mergify[bot] merged 4 commits into
masterfrom
feat-upload-fields

Conversation

@tjuanitas
Copy link
Copy Markdown
Contributor

@tjuanitas tjuanitas commented May 27, 2026

Summary by CodeRabbit

  • New Features

    • Upload operations now support an optional fields parameter to request additional metadata during file transfers and resumes when modernized uploads are enabled.
  • Chores

    • Updated Node.js version setup instructions in development documentation.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Walkthrough

The changes introduce optional fields query parameter support across the upload stack. Field constants and utilities are defined, then propagated through the base upload class, concrete implementations (PlainUpload and MultiputUpload), and wired into ContentUploader to conditionally include fields when modernized uploads are enabled.

Changes

Upload Fields Query Parameter Support

Layer / File(s) Summary
Field constants and utilities definition
src/constants.js, src/utils/fields.js
FIELD_ITEM_STATUS and FIELD_PURGED_AT constants are added and imported into a utilities module, which defines and exports UPLOADER_FIELDS_TO_FETCH as the canonical set of fields for uploader API requests.
Base upload class field property
src/api/uploads/BaseUpload.js
BaseUpload adds a nullable fields: ?Array<string> instance property to establish the shared contract across upload implementations.
PlainUpload fields implementation
src/api/uploads/PlainUpload.js
PlainUpload.upload() accepts optional fields in its options, stores it on the instance, and modifies the upload URL via updateQueryParameters to include fields as a query parameter during preflight.
MultiputUpload fields implementation
src/api/uploads/MultiputUpload.js
MultiputUpload propagates fields through setFileInfo(), upload(), and resume() methods; when restarting after session failure, fields are preserved, and during commitSession(), fields are appended to the commit endpoint URL.
ContentUploader conditional fields integration
src/elements/content-uploader/ContentUploader.tsx
ContentUploader conditionally adds fields: UPLOADER_FIELDS_TO_FETCH to upload and resume options when enableModernizedUploads is enabled; JSX formatting in render() is adjusted.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • box/box-ui-elements#4571: Both PRs modify src/elements/content-uploader/ContentUploader.tsx around the shared enableModernizedUploads flag—this PR adds fields/UPLOADER_FIELDS_TO_FETCH to upload/resume options when the flag is enabled, building on the related PR's feature-flagged modernized uploads foundation.

Suggested labels

ready-to-merge

Suggested reviewers

  • greg-in-a-box
  • dlasecki-box
  • olehrybak

Poem

🐰 Fields now flow through uploads so fine,
Constants defined, then wired to align,
PlainUpload, Multiput—both now aware,
ContentUploader gates them with modernized care! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author. The description is entirely missing, leaving reviewers without context about the changes, rationale, or testing information. Provide a comprehensive pull request description explaining the feature purpose, implementation details, API changes, and any testing performed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main feature: updating fields in the uploads response. It aligns well with the primary changeset focused on adding field support to upload classes and the ContentUploader component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-upload-fields

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tjuanitas tjuanitas marked this pull request as ready for review May 27, 2026 15:32
@tjuanitas tjuanitas requested review from a team as code owners May 27, 2026 15:32
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/api/uploads/PlainUpload.js`:
- Around line 77-79: The preflight path that assigns data.upload_url bypasses
the block that appends this.fields via updateQueryParameters, so fields aren't
added to preflight-provided upload URLs; modify the logic in PlainUpload.js
where uploadUrl is set from data.upload_url (and the branch handling preflight
responses) to always call updateQueryParameters(uploadUrl, { fields:
this.fields.toString() }) when this.fields is present (same behavior as the
existing branch), ensuring any code paths that set uploadUrl (including
data.upload_url) append the fields query parameter.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5085a6b-1dbb-4f0f-b003-58ec46b2f362

📥 Commits

Reviewing files that changed from the base of the PR and between 49bffba and 836251f.

📒 Files selected for processing (7)
  • DEVELOPING.md
  • src/api/uploads/BaseUpload.js
  • src/api/uploads/MultiputUpload.js
  • src/api/uploads/PlainUpload.js
  • src/constants.js
  • src/elements/content-uploader/ContentUploader.tsx
  • src/utils/fields.js

Comment thread src/api/uploads/PlainUpload.js
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 28, 2026

Merge Queue Status

  • Entered queue2026-05-28 00:11 UTC · Rule: Automatic strict merge
  • Checks passed · in-place
  • Merged2026-05-28 00:22 UTC · at aba438a6e85cb2c12bad99df40badf107429080f · squash

This pull request spent 11 minutes 11 seconds in the queue, including 10 minutes 42 seconds running CI.

Required conditions to merge

@mergify mergify Bot merged commit 54c9214 into master May 28, 2026
13 checks passed
@mergify mergify Bot deleted the feat-upload-fields branch May 28, 2026 00:22
@mergify mergify Bot removed the queued label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants