You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Attachment - Csv file uploaded with other files is not shown in chat #80993
If we send only csv files, all files will be marked as "invalid", and the logic above returns early, so the validFiles is not changed. So the csv files are shown in that case.
What alternative solutions did you explore? (Optional)
N/A
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Please re-state the problem that we are trying to solve in this issue.
When uploading a CSV file together with other files (like images), the CSV file is not displayed in the chat message, while the image appears correctly. The CSV file is visible in the preview, but once sent, only the image shows in the chat.
Each attachment gets its own report action with HTML representing the file
For images, the HTML is an <img> tag and the text is [Attachment]
For non-image files (CSV, PDF, etc.), the HTML is an <a> tag and the text is the filename (e.g., "CSV_0.csv")
The isReportMessageAttachment function checks:
If text === "[Attachment]" → return true
Else if Str.isVideo(text) → return true
Otherwise → return false
For CSV files where text = "CSV_0.csv", both conditions fail, so the function returns false. This causes the fragment to render as TextCommentFragment (plain text filename) instead of AttachmentCommentFragment (clickable attachment with proper rendering).
What changes do you think we should make in order to solve the problem?
Modify isReportMessageAttachment to return true for any message that has the data-expensify-source attribute in its HTML, regardless of the text content. The presence of this attribute is the definitive marker that content is an Expensify attachment.
The fix simplifies the logic:
If HTML doesn't contain data-expensify-source → return false
If it does contain the attribute → return true
This ensures all attachment types (images, videos, CSV, PDF, etc.) are properly recognized and rendered as attachments.
What alternative solutions did you explore? (Optional)
🤖 After investigating, it appears this bug has already been fixed on main by PR #70740 (attachment validation refactor, merged March 18).
What changed: The isFileCorrupted function that applied the MIN_SIZE check to all files was removed. The validation logic was restructured into src/libs/validateAttachmentFile.ts, where the MIN_SIZE check is now properly guarded:
For regular chat attachments, isValidatingReceipts is false (set explicitly in useAttachmentUploadValidation and defaulted in ReportAddAttachmentModalContent), so the MIN_SIZE check is skipped entirely for non-receipt uploads. This means small CSV files are no longer silently rejected when uploaded alongside images.
My existing PR (#85345) has merge conflicts because the code it modified no longer exists on main. Since the fix is already in place, that PR is now obsolete.
Suggested next step: Please verify on the latest build that uploading a CSV + image together in chat works correctly. If the bug is still reproducible on the latest version, please let me know and I'll investigate further.
Activity
mkzie2 commentedon Jan 30, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Csv file uploaded with other files is not shown in chat but shown in preview.
What is the root cause of that problem?
validateImageForCorruptionimmediately resolves if the file is not image:App/src/libs/fileDownload/FileUtils.ts
Lines 285 to 287 in 0649d6e
Then for csv files - the file size is usually very small (<240 bytes),
isFileCorruptedwill return result as invalid here:App/src/libs/AttachmentUtils.ts
Lines 78 to 83 in 0649d6e
Then "invalid" csv files will be filtered out here, and not displayed:
App/src/pages/media/AttachmentModalScreen/routes/report/ReportAddAttachmentModalContent/index.tsx
Lines 93 to 105 in 0649d6e
If we send only csv files, all files will be marked as "invalid", and the logic above returns early, so the
validFilesis not changed. So the csv files are shown in that case.App/src/pages/media/AttachmentModalScreen/routes/report/ReportAddAttachmentModalContent/index.tsx
Line 86 in 0649d6e
What changes do you think we should make in order to solve the problem?
isFileCorruptedonly checks for image integrity, so we should return early here if the file is not image:We can place that logic before here
App/src/libs/AttachmentUtils.ts
Line 69 in 0649d6e
Or before here
App/src/libs/AttachmentUtils.ts
Line 71 in 0649d6e
Or we only check the image logic in the minimum size calculation and leave the max size check as-is:
App/src/libs/AttachmentUtils.ts
Line 78 in 0649d6e
What alternative solutions did you explore? (Optional)
N/A
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
cosmicvulpes commentedon Jan 30, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When uploading a CSV file together with other files (like images), the CSV file is not displayed in the chat message, while the image appears correctly. The CSV file is visible in the preview, but once sent, only the image shows in the chat.
What is the root cause of that problem?
The root cause is in the
isReportMessageAttachmentfunction atsrc/libs/isReportMessageAttachment.ts.When attachments are uploaded:
<img>tag and the text is[Attachment]<a>tag and the text is the filename (e.g., "CSV_0.csv")The
isReportMessageAttachmentfunction checks:text === "[Attachment]"→ returntrueStr.isVideo(text)→ returntruefalseFor CSV files where
text = "CSV_0.csv", both conditions fail, so the function returnsfalse. This causes the fragment to render asTextCommentFragment(plain text filename) instead ofAttachmentCommentFragment(clickable attachment with proper rendering).What changes do you think we should make in order to solve the problem?
Modify
isReportMessageAttachmentto returntruefor any message that has thedata-expensify-sourceattribute in its HTML, regardless of the text content. The presence of this attribute is the definitive marker that content is an Expensify attachment.The fix simplifies the logic:
data-expensify-source→ returnfalsetrueThis ensures all attachment types (images, videos, CSV, PDF, etc.) are properly recognized and rendered as attachments.
What alternative solutions did you explore? (Optional)
N/A
27 remaining items
JmillsExpensify commentedon Mar 16, 2026
@truph01 there you go
truph01 commentedon Apr 2, 2026
@MelvinBot, please create PR to fix this issue
MelvinBot commentedon Apr 2, 2026
🤖 After investigating, it appears this bug has already been fixed on
mainby PR #70740 (attachment validation refactor, merged March 18).What changed: The
isFileCorruptedfunction that applied theMIN_SIZEcheck to all files was removed. The validation logic was restructured intosrc/libs/validateAttachmentFile.ts, where theMIN_SIZEcheck is now properly guarded:For regular chat attachments,
isValidatingReceiptsisfalse(set explicitly inuseAttachmentUploadValidationand defaulted inReportAddAttachmentModalContent), so theMIN_SIZEcheck is skipped entirely for non-receipt uploads. This means small CSV files are no longer silently rejected when uploaded alongside images.My existing PR (#85345) has merge conflicts because the code it modified no longer exists on
main. Since the fix is already in place, that PR is now obsolete.Suggested next step: Please verify on the latest build that uploading a CSV + image together in chat works correctly. If the bug is still reproducible on the latest version, please let me know and I'll investigate further.
truph01 commentedon Apr 2, 2026
@JmillsExpensify, This issue was fixed by another PR. Could you ask for a retest here?
Screen.Recording.2026-04-02.at.15.56.45.mov
JmillsExpensify commentedon Apr 6, 2026
Done. I asked in Slack.
IuliiaHerets commentedon Apr 6, 2026
Issue is not reproducible on Web (Mac Chrome) and Android (SG-A54 - Android 16), v9.3.52-8
2026-04-06.5.41.00.PM.mp4
Screen.Recording.2026-04-06.at.5.34.41.PM.mov
JmillsExpensify commentedon Apr 6, 2026
@truph01 let me know if you are due payment for this issue.
truph01 commentedon Apr 6, 2026
@JmillsExpensify I believe I should be eligible for payment, as I reviewed the PR and the issue was subsequently resolved in a different PR.
JmillsExpensify commentedon Apr 6, 2026
Payment summary: $250 @truph01 for PR proposal and reviews.
JmillsExpensify commentedon Apr 6, 2026
Agreed, that makes sense to me. Payment summary above.
garrettmknight commentedon May 10, 2026
$250 approved for @truph01