Skip to content

feat(content-uploader): add file version in content uploader API#4581

Open
olehrybak wants to merge 4 commits into
box:masterfrom
olehrybak:uploads-manager-versioning-update
Open

feat(content-uploader): add file version in content uploader API#4581
olehrybak wants to merge 4 commits into
box:masterfrom
olehrybak:uploads-manager-versioning-update

Conversation

@olehrybak
Copy link
Copy Markdown
Contributor

@olehrybak olehrybak commented May 21, 2026

Summary

Passed a new fields query parameter to the file new version upload link. Parameter includes a list of all default fields returned by the upload endpoint along with the additional version_number field (we need to provide the full list according to docs).

The change is guarded by the enableModernizedUploads flag.

Summary by CodeRabbit

  • New Features

    • Added opt-in "modernized uploads" that, when enabled, include additional metadata (including item status, purge timestamp, and version info) during preflight/commit and across resume/restart flows.
  • Refactor

    • Propagated the modernized upload flag through upload/resume APIs and consolidated new standard upload field sets and constants to support the capability.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 96656196-133f-4261-a980-fe47d43ecb7d

📥 Commits

Reviewing files that changed from the base of the PR and between ddf8e84 and 85b8cc9.

📒 Files selected for processing (2)
  • src/api/uploads/MultiputUpload.js
  • src/api/uploads/PlainUpload.js
💤 Files with no reviewable changes (2)
  • src/api/uploads/PlainUpload.js
  • src/api/uploads/MultiputUpload.js

Walkthrough

This PR threads an enableModernizedUploads flag through upload APIs and UI, defines new field constants and a derived standard field list, and conditionally appends those fields as a fields query parameter to preflight/commit upload URLs when the flag is enabled.

Changes

Modernized uploads feature

Layer / File(s) Summary
Field constants and derived upload field arrays
src/constants.js, src/utils/fields.js
New field constants FIELD_ITEM_STATUS and FIELD_PURGED_AT are added. STANDARD_UPLOAD_FIELDS and STANDARD_UPLOAD_FIELDS_WITH_VERSION_NUMBER are defined and exported for use in query fields parameters.
Base upload class field declaration
src/api/uploads/BaseUpload.js
Adds enableModernizedUploads: boolean = false to BaseUpload.
MultiputUpload modernized uploads
src/api/uploads/MultiputUpload.js
Accepts enableModernizedUploads in setFileInfo, upload, and resume; persists it; threads it through restart flows; and when enabled and fileId exists, appends fields (from STANDARD_UPLOAD_FIELDS_WITH_VERSION_NUMBER) to the commit POST URL.
PlainUpload modernized uploads
src/api/uploads/PlainUpload.js
upload() accepts enableModernizedUploads, stores it on the instance, and conditionally adds fields (from STANDARD_UPLOAD_FIELDS_WITH_VERSION_NUMBER) to the preflight upload URL when enabled and fileId is present.
ContentUploader component integration
src/elements/content-uploader/ContentUploader.tsx
Reads enableModernizedUploads prop and includes it in uploadOptions/resumeOptions passed to api.upload()/api.resume().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • box/box-ui-elements#4571: Both PRs use the enableModernizedUploads prop in ContentUploader.tsx; #4571 gates upload UI while this PR threads the flag into API behavior.

Suggested reviewers

  • dlasecki-box
  • tjiang-box

🐰 I hop through code with a curious cheer,
Flag in paw, fields held near,
Requests now carry metadata bright,
Commits and preflight take off in flight,
Modern uploads — a rabbit's delight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(content-uploader): add file version in content uploader API' accurately describes the main change—adding version number support to the content uploader API.
Description check ✅ Passed The PR description clearly explains the purpose (adding a fields parameter for version number support), the implementation approach (guarded by enableModernizedUploads flag), and references relevant documentation.
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 unit tests (beta)
  • Create PR with unit tests

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.

@olehrybak olehrybak force-pushed the uploads-manager-versioning-update branch from 3aa5abe to ddf8e84 Compare May 25, 2026 13:37
@olehrybak olehrybak marked this pull request as ready for review May 25, 2026 14:36
@olehrybak olehrybak requested review from a team as code owners May 25, 2026 14:36
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