Skip to content

Conversation

@ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Jan 22, 2026

Proposed changes (including videos or screenshots)

Messages with multiple file attachments were only exporting the first file when using the "Export Room Messages" feature.

The exportRoomMessages function only handled msg.file (deprecated single file property) and ignored msg.files (new array for multiple files).

Issue(s)

Steps to test or reproduce

  • Enable multiple file uploads: Admin -> Settings -> File Upload -> Maximum amount of files per message.
  • Send a message with multiple files attached.
  • Go to Room -> kebab menu -> Export Messages -> Send via email as HTML*.

*you'll have to enable email locally - more infos can be found here: #38183

Before the change

  • Check the received email/ZIP: only the first attachment is included.

After the change

  • Check the received email/ZIP: all attached files are included.

Summary by CodeRabbit

Bug Fixes

  • Fixed room message export to correctly handle messages with multiple attached files. The export now properly aggregates and processes all file attachments per message.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 22, 2026

🦋 Changeset detected

Latest commit: 73f4907

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

This PR includes changesets to release 40 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core 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

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.75%. Comparing base (647dca1) to head (73f4907).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38292      +/-   ##
===========================================
+ Coverage    70.74%   70.75%   +0.01%     
===========================================
  Files         3142     3142              
  Lines       108926   108927       +1     
  Branches     19602    19590      -12     
===========================================
+ Hits         77059    77074      +15     
+ Misses       29863    29854       -9     
+ Partials      2004     1999       -5     
Flag Coverage Δ
e2e 60.31% <ø> (+<0.01%) ⬆️
e2e-api 48.09% <27.27%> (+0.02%) ⬆️
unit 71.88% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2026

📦 Docker Image Size Report

➡️ Changes

Service Current Baseline Change Percent
sum of all images 0B 0B 0B
account-service 0B 0B 0B
authorization-service 0B 0B 0B
ddp-streamer-service 0B 0B 0B
omnichannel-transcript-service 0B 0B 0B
presence-service 0B 0B 0B
queue-worker-service 0B 0B 0B
rocketchat 0B 0B 0B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 22:45", "12/13 01:34", "12/15 22:31", "12/16 22:18", "12/17 21:04", "12/18 23:12", "12/19 23:27", "12/20 21:03", "12/22 18:54", "12/23 16:16", "12/24 19:38", "12/25 17:51", "12/26 13:18", "12/29 19:01", "12/30 20:52", "01/22 15:42 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.00]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "queue-worker-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "rocketchat" [0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.00]
Loading

Statistics (last 30 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.4GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 0B
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-38292
  • Baseline: develop
  • Timestamp: 2026-01-22 15:42:49 UTC
  • Historical data points: 30

Updated: Thu, 22 Jan 2026 15:42:50 GMT

@ricardogarim ricardogarim added this to the 8.2.0 milestone Jan 22, 2026
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 22, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is targeting the wrong base branch. It should target 8.2.0, but it targets 8.1.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Walkthrough

This PR fixes room message export functionality to handle messages with multiple file attachments. The exportMessageObject function signature is updated to accept an array of files instead of a single file, with backward compatibility maintained for the legacy single-file property in the export process.

Changes

Cohort / File(s) Summary
Changeset metadata
.changeset/quick-schools-hear.md
New changeset entry marking patch version for @rocket.chat/meteor documenting the fix for room message export with multiple files.
Core export logic
apps/meteor/server/lib/dataExport/exportRoomMessagesToFile.ts
Updated exportMessageObject to accept messageFiles: FileProp[] instead of single messageFile?: FileProp. Iterates over all files to attach corresponding attachments. In exportRoomMessages, maintains backward compatibility by accepting both msg.files (new) and msg.file (legacy), filtering out thumbnails, and passing complete files array to export function.
Unit tests
apps/meteor/tests/unit/server/lib/dataExport/exportRoomMessagesToFile.spec.ts
Updated existing test calls to pass files as arrays. Added two new test cases: one for exporting multiple files with thumbnail filtering, another for fallback behavior when msg.files unavailable (using msg.file).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • RocketChat/Rocket.Chat#38084: Updates server code to handle IMessage.files (multiple-file attachments) in addition to legacy IMessage.file property.

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • tassoevan
  • pierre-lehnen-rc
  • KevLehman

Poem

🐰 Hop, hop, the files now flow,
Multiple attachments steal the show,
Export them all with graceful care,
No messages left without their share! 📎

🚥 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 clearly and concisely describes the main fix: adding support for multiple file exports in room message exports.
Linked Issues check ✅ Passed The PR implementation fully addresses the CORE-1626 requirement to handle multiple files (msg.files array) and prevent attachment loss during export.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the room message export functionality: updating exportMessageObject signature, handling multiple files with backward compatibility, adding appropriate tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/multi-file-room-export

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.

@ricardogarim ricardogarim marked this pull request as ready for review January 22, 2026 15:28
@ricardogarim ricardogarim requested a review from a team as a code owner January 22, 2026 15:28
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Copy link
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

🤖 Fix all issues with AI agents
In `@apps/meteor/server/lib/dataExport/exportRoomMessagesToFile.ts`:
- Around line 234-239: The current fallback logic for files drops a legacy
msg.file when msg.files exists but is empty; change the selection so that if
msg.files is absent or an empty array you fall back to msg.file (e.g., use
msg.files only when it is a non-empty array, otherwise use [msg.file] if
present) before applying the thumbnail filter and then push to result.uploads
and call exportMessageObject; update the files assignment near the existing
files const and keep using result.uploads.push(...files) and
result.messages.push(exportMessageObject(exportType, messageObject, files)).

Comment on lines +234 to +239
// handle both new format (msg.files array) and old format (msg.file) for backward compatibility
// and filter out thumbnails (typeGroup === 'thumb') to only include actual files
const files = (msg.files || (msg.file ? [msg.file] : [])).filter((file) => file && file.typeGroup !== 'thumb');

result.messages.push(exportMessageObject(exportType, messageObject, msg.file));
result.uploads.push(...files);
result.messages.push(exportMessageObject(exportType, messageObject, files));
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid dropping legacy msg.file when msg.files is empty.
If msg.files is an empty array but msg.file exists, the current fallback skips the legacy file. Consider falling back when the array is empty to prevent missing attachments.

🛠️ Suggested fix
-		const files = (msg.files || (msg.file ? [msg.file] : [])).filter((file) => file && file.typeGroup !== 'thumb');
+		const filesSource = msg.files && msg.files.length ? msg.files : msg.file ? [msg.file] : [];
+		const files = filesSource.filter((file) => file && file.typeGroup !== 'thumb');
🤖 Prompt for AI Agents
In `@apps/meteor/server/lib/dataExport/exportRoomMessagesToFile.ts` around lines
234 - 239, The current fallback logic for files drops a legacy msg.file when
msg.files exists but is empty; change the selection so that if msg.files is
absent or an empty array you fall back to msg.file (e.g., use msg.files only
when it is a non-empty array, otherwise use [msg.file] if present) before
applying the thumbnail filter and then push to result.uploads and call
exportMessageObject; update the files assignment near the existing files const
and keep using result.uploads.push(...files) and
result.messages.push(exportMessageObject(exportType, messageObject, files)).

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