chore!: Remove /ufs endpoint - #41054
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📜 Recent review details⏰ Context from checks skipped due to timeout. (7)
|
| Layer / File(s) | Summary |
|---|---|
UFS config, store, and server removal apps/meteor/server/ufs/ufs-config.ts, apps/meteor/server/ufs/ufs-store.ts, apps/meteor/server/ufs/ufs-server.ts, apps/meteor/app/file-upload/server/config/GridFS.ts |
Removes storesPath from UFS config, stops persisting upload path and URL fields in the store, deletes the HTTP file-serving handler and its supporting imports, and removes the GridFS compatibility alias. |
File upload auth and completion changes apps/meteor/app/file-upload/server/lib/FileUpload.ts, apps/meteor/app/file-upload/server/lib/FileUpload.spec.ts, apps/meteor/app/api/server/v1/rooms.ts |
Removes store-level read authorization handlers and FileUpload.getRequestUserId, updates upload completion to persist public path and url, and trims the related unit spec coverage. |
Consumer URL updates and rollout note apps/meteor/app/slackbridge/server/SlackAdapter.ts, apps/meteor/client/views/room/contextualBar/RoomFiles/components/FileItemMenu.tsx, apps/meteor/app/apps/server/converters/uploads.js, apps/meteor/tests/end-to-end/api/rooms.ts, .changeset/better-results-press.md |
Updates file download URL construction in Slack, room UI, app upload conversion, and end-to-end media tests, and adds the release note entry for the endpoint removal. |
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
Suggested reviewers
- tassoevan
- MartinSchoeler
Possibly related PRs
- RocketChat/Rocket.Chat#40893: Modifies
apps/meteor/app/file-upload/server/lib/FileUpload.tsaround download authorization andgetRequestUserId/requestCanAccessFilesbehavior, which overlaps with this PR’s file-upload access changes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately summarizes the main breaking change: removal of the legacy /ufs file-download endpoint. |
| 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. |
Warning
There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 Biome (2.5.0)
apps/meteor/app/apps/server/converters/uploads.js
File contains syntax errors that prevent linting: Line 1: Illegal use of an import declaration outside of a module; Line 3: Illegal use of an import declaration outside of a module; Line 4: Illegal use of an import declaration outside of a module; Line 6: Illegal use of an export declaration outside of a module
Warning
Review ran into problems
🔥 Problems
Errors were encountered while retrieving linked issues.
Errors (1)
- CORE-2283: Request failed with status code 401
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.
Comment @coderabbitai help to get the list of available commands.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-9.0.0 #41054 +/- ##
================================================
Coverage ? 70.08%
================================================
Files ? 3355
Lines ? 128931
Branches ? 22335
================================================
Hits ? 90367
Misses ? 35282
Partials ? 3282
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
🦋 Changeset detectedLatest commit: e91e908 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/meteor/app/file-upload/server/lib/FileUpload.ts (1)
502-518: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winHandle the case where both room restriction settings are enabled.
With both booleans true, authenticated room-file requests skip both single-setting branches and fall through to
return false.Proposed fix
- if (fileUploadRestrictedToMembers && !fileUploadRestrictToUsersWhoCanAccessRoom) { + if (fileUploadRestrictedToMembers) { const sub = await Subscriptions.findOneByRoomIdAndUserId(file.rid, user._id, { projection: { _id: 1 } }); - return !!sub; + if (!sub) { + return false; + } } - if (fileUploadRestrictToUsersWhoCanAccessRoom && !fileUploadRestrictedToMembers) { + if (fileUploadRestrictToUsersWhoCanAccessRoom) { return canAccessRoomIdAsync(file.rid, user._id); } - return false; + return true;🤖 Prompt for 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. In `@apps/meteor/app/file-upload/server/lib/FileUpload.ts` around lines 502 - 518, The access check in FileUpload.ts’s room-file permission logic currently returns false when both FileUpload_Restrict_to_room_members and FileUpload_Restrict_to_users_who_can_access_room are enabled because neither single-setting branch matches. Update the conditional flow in the room access check so the both-true case is handled explicitly, and make it enforce the intended combined rule using the existing helpers Subscriptions.findOneByRoomIdAndUserId and canAccessRoomIdAsync rather than falling through to the default false.
🧹 Nitpick comments (2)
apps/meteor/app/file-upload/server/lib/FileUpload.ts (1)
868-870: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove implementation comments from the changed logic.
The new comments can be moved to the PR/release note context instead of living in implementation code.
Proposed cleanup
- // `/ufs` used to serve every store generically; it was replaced by per-store routes. - // Persist the store-aware public path/url so anything reading `IUpload.url`/`.path` - // (apps, integrations, …) keeps getting a link that resolves. const path = this.getPublicPath(file); ... - // The modern route depends on which store the file lives in (the old `/ufs` path served all of them). private getPublicPath(file: IUpload): string | undefined {As per coding guidelines,
**/*.{ts,tsx,js}should avoid code comments in the implementation.Also applies to: 885-885
🤖 Prompt for 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. In `@apps/meteor/app/file-upload/server/lib/FileUpload.ts` around lines 868 - 870, The changed logic in FileUpload.ts includes implementation comments that should be removed from the code. Delete the new explanatory comments near the store-aware public path/url handling, keeping the behavior in the relevant FileUpload path assignment logic intact, and leave any rationale in the PR or release notes instead of the implementation.Source: Coding guidelines
apps/meteor/app/apps/server/converters/uploads.js (1)
23-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDrop the new implementation comments.
The mapping is readable without them, and the migration rationale belongs in release/PR documentation.
Proposed cleanup
- // `url`/`path` are no longer persisted on the upload; derive them from the file id+name, - // matching the canonical /file-upload route. Declared before `id`/`name` so the source - // fields are still present on the cloned data when these run. url: (upload) => {As per coding guidelines,
**/*.{ts,tsx,js}should avoid code comments in the implementation.🤖 Prompt for 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. In `@apps/meteor/app/apps/server/converters/uploads.js` around lines 23 - 25, The new implementation comments in the upload conversion logic should be removed because the mapping is already clear and implementation commentary is discouraged. Clean up the `mapUpload`/upload-field derivation block in `uploads.js` so it keeps only the code that computes `url` and `path` from `id` and `name`, without the explanatory comment lines.Source: Coding guidelines
🤖 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 `@apps/meteor/app/apps/server/converters/uploads.js`:
- Around line 26-34: The upload URL/path builders in the uploads converter are
using encodeURI on the filename, which can leave reserved characters unescaped
and break the generated path. Update the filename encoding in both the url and
path functions to use encodeURIComponent when building the relativePath for
upload._id and upload.name, keeping the rest of the logic in place.
In `@apps/meteor/app/file-upload/server/lib/FileUpload.ts`:
- Around line 886-889: In getPublicPath, the filename segment is being encoded
with encodeURI, which can leave URL-breaking characters like #, ?, and /
unescaped. Update the FileUpload.getPath call in getPublicPath to use
encodeURIComponent for file.name so the filename is treated as a single safe
path segment. Keep the existing Uploads check and path structure unchanged, and
only swap the encoding used for the filename value.
---
Outside diff comments:
In `@apps/meteor/app/file-upload/server/lib/FileUpload.ts`:
- Around line 502-518: The access check in FileUpload.ts’s room-file permission
logic currently returns false when both FileUpload_Restrict_to_room_members and
FileUpload_Restrict_to_users_who_can_access_room are enabled because neither
single-setting branch matches. Update the conditional flow in the room access
check so the both-true case is handled explicitly, and make it enforce the
intended combined rule using the existing helpers
Subscriptions.findOneByRoomIdAndUserId and canAccessRoomIdAsync rather than
falling through to the default false.
---
Nitpick comments:
In `@apps/meteor/app/apps/server/converters/uploads.js`:
- Around line 23-25: The new implementation comments in the upload conversion
logic should be removed because the mapping is already clear and implementation
commentary is discouraged. Clean up the `mapUpload`/upload-field derivation
block in `uploads.js` so it keeps only the code that computes `url` and `path`
from `id` and `name`, without the explanatory comment lines.
In `@apps/meteor/app/file-upload/server/lib/FileUpload.ts`:
- Around line 868-870: The changed logic in FileUpload.ts includes
implementation comments that should be removed from the code. Delete the new
explanatory comments near the store-aware public path/url handling, keeping the
behavior in the relevant FileUpload path assignment logic intact, and leave any
rationale in the PR or release notes instead of the implementation.
🪄 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: 2941aac4-004f-4f24-b048-b6632e3ff962
📒 Files selected for processing (4)
apps/meteor/app/api/server/v1/rooms.tsapps/meteor/app/apps/server/converters/uploads.jsapps/meteor/app/file-upload/server/lib/FileUpload.spec.tsapps/meteor/app/file-upload/server/lib/FileUpload.ts
💤 Files with no reviewable changes (1)
- apps/meteor/app/api/server/v1/rooms.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/meteor/app/file-upload/server/lib/FileUpload.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (8)
- GitHub Check: 🔨 Test Storybook / Test Storybook
- GitHub Check: 🔎 Code Check / Code Lint
- GitHub Check: 🔎 Code Check / TypeScript
- GitHub Check: 🔨 Test Unit / Unit Tests
- GitHub Check: 📦 Meteor Build (coverage)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (5)
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/app/apps/server/converters/uploads.jsapps/meteor/app/file-upload/server/lib/FileUpload.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/app/file-upload/server/lib/FileUpload.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/app/file-upload/server/lib/FileUpload.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/app/file-upload/server/lib/FileUpload.ts
🪛 Biome (2.5.0)
apps/meteor/app/apps/server/converters/uploads.js
[error] 4-4: Illegal use of an import declaration outside of a module
(parse)
🔇 Additional comments (2)
apps/meteor/app/file-upload/server/lib/FileUpload.ts (1)
38-38: LGTM!Also applies to: 56-67, 84-92
apps/meteor/app/apps/server/converters/uploads.js (1)
4-4: LGTM!Also applies to: 47-47
There was a problem hiding this comment.
2 issues found across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
I'll defer mobile testing to later. As this is on V9, mobile app is not yet compatible. |
Proposed changes (including videos or screenshots)
Issue(s)
https://rocketchat.atlassian.net/browse/CORE-2283
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Summary by CodeRabbit
New Features
/file-upload/<id>/<encoded name>across UI, API conversion, and Slack bridging.Breaking Changes
/ufsfile-download endpoint and associated URL/path persistence for UFS.Refactor
Documentation / Configuration
storesPathoption from UploadFS.Tests