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
[Due for payment 2026-08-07] [$250] chat-Image paste is allowed in Edit Comment, resulting in a separate attachment message #94879
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Note a seperate text plus attachment chat is shown
Expected Result:
The user should not be able to paste an image while editing a comment.
Actual Result:
The user is able to paste an image while editing a comment. The pasted image remains stuck in a loading state and is not displayed. After tapping Send, a separate text + attachment message is created.
🚨 Edited by proposal-police: This proposal was edited at 2026-06-29 17:07:55 UTC.
Proposal
What is the root cause of that problem?
The mobile edit-comment flow reuses the main report composer. While edit mode replaces the normal attachment action button with edit controls, ComposerInput still forwards every pasted file to pickAttachments, and useAttachmentPicker stores confirmed files in attachmentFileRef before clearing the composer.
On native, the composer treats non-text clipboard content as a file and calls onPasteFile, so pasted images can enter the attachment flow even while a comment is being edited.
When the user taps send/save after that, edit submission only publishes the edited draft when attachmentFileRef is empty. If that ref is populated, the submit path calls addAttachmentWithComment, which creates a separate attachment message instead of only saving the edited comment.
What changes do you think we should make in order to solve the problem?
In ComposerInput, read the existing edit state from useComposerEditState() and make the onPasteFile handler return without calling pickAttachments({files}) while the composer is editing a message. When the edit state is off, keep the current pickAttachments({files}) behavior unchanged.
That keeps normal image/file paste behavior for new comments, but prevents edit-comment mode from opening the attachment preview or populating attachmentFileRef.
Add a focused ReportActionCompose UI test for active edit-comment mode that simulates an image/file paste and verifies the attachment preview/navigation is not triggered.
Add or keep coverage for normal compose mode verifying pasted files still go through the attachment flow.
Manually verify on Android and iOS that pasting an image while editing a comment does nothing attachment-related, saving the edit only updates the comment, and pasting an image in the normal composer still works.
What alternative solutions did you explore? (Optional)
We could block pasted files inside useAttachmentPicker, but the bug is specific to edit-comment mode and the edit state already belongs to the composer layer. Gating the onPasteFile callback in ComposerInput keeps the attachment picker reusable for normal compose, action-menu, and drop-zone attachment flows.
changed the title [-]chat-Image paste is allowed in Edit Comment, resulting in a separate attachment message[/-][+][$250] chat-Image paste is allowed in Edit Comment, resulting in a separate attachment message[/+]on Jun 29, 2026
⚠️@KJ21-ENG Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 06:44:52 UTC.
Proposal
What is the root cause of that problem?
On native mobile (Android/iOS), editing a comment happens inside the main report composer. The composer tracks edit mode via isEditingInComposer and didResetComposerHeightWhileEditing. All composer controls — the action menu, the send button — are already gated on that edit state ComposerActionButton.tsx#L6-L12
The submit logic only treats the operation as an edit when attachmentFileRef is empty. Once the paste populates that ref, the submit path takes the wrong branch.
There is also a stale-state issue: if the user pastes a file in normal compose mode, cancels the attachment preview, then starts editing, the ref is never cleared useAttachmentPicker.ts#L33-L39
, read the full edit state — both isEditingInComposer and didResetComposerHeightWhileEditing — and make the paste handler return early without calling the attachment picker when either flag is true. This prevents the invalid state before any side effects occur: no validation, no preview navigation, no ref mutation. The paste is silently dropped.
Inside the attachment picker. In useAttachmentPicker
, read the same edit state and guard pickAttachments at the top. This blocks all attachment entry points during edit mode — paste, drag-and-drop, and any future entry points — at the lowest level. The hook is already coupled to the composer context via useComposerMeta(), so this is consistent with the existing architecture.
, clear attachmentFileRef when isEditingInComposer transitions to true. This handles the case where the user had a pending attachment from a cancelled preview before entering edit mode.
, unconditionally clear attachmentFileRef and call publishDraft whenever the operation is an edit. This is the last line of defense: if any of the three layers above somehow fails, the edit is still published correctly.
What alternative solutions did you explore? (Optional)
Guarding only on isEditingInComposer (without didResetComposerHeightWhileEditing) is insufficient because the submit logic at useComposerSubmit.ts#L68
treats both flags as edit state. A paste during the height-reset window would bypass the narrower guard.
Hardening the shared native Composer to conditionally register paste handling targets the wrong component — ReportActionItemMessageEdit on desktop, not the main ComposerInput where this bug actually occurs on mobile.
Adding an isFocused() guard in the native Composer's paste handler addresses a different concern. The issue is not about focus — it is about the focused main composer forwarding paste during edit mode.
🚨 Edited by proposal-police: This proposal was edited at 2026-06-29 16:56:30 UTC.
Proposal
What is the root cause of that problem?
The native Android/iOS composer supports file paste through TextInput’s native onPaste event. When the pasted content is not plain text, index.native.tsx builds a FileObject, resolves the file size, and always calls onPasteFile(file):
This conflicts with the edit-composer submit logic. useComposerSubmit publishes an edit only when attachmentFileRef.current is empty. Once paste has populated that ref, Send falls into the attachment branch and calls addAttachmentWithComment, creating a new text + attachment message:
History makes the mismatch clearer. Commit 6952c27f29db extracted attachment handling into useAttachmentPicker and moved paste handling into ComposerInput without edit-mode awareness:
This fixes the Android/iOS bug because the native onPaste path still works normally, but edit mode no longer lets pasted images populate attachmentFileRef.
To avoid regressions:
Do not change index.native.tsx; keep native paste parsing/file-size resolution unchanged.
Do not change useAttachmentPicker; normal attachment picking, normal image paste, and attachment preview behavior stay the same.
Only block the composer paste callback when isEditingInComposer is true, matching the existing UI rule that hides the attachment action during edit mode.
Keep normal compose mode behavior unchanged for Android, iOS, and web.
Test coverage:
Android/iOS native composer: start editing a message, paste an image, verify no attachment preview opens and Send saves the edited comment only.
Android/iOS native composer: in normal compose mode, paste an image and verify the existing attachment preview/send flow still works.
Submit flow: verify editing with no attachment still calls publishDraft, and pasting during edit does not cause addAttachmentWithComment.
What alternative solutions did you explore? (Optional)
We could block this in index.native.tsx, but that would put report/edit-composer knowledge into the shared native composer implementation and would only cover mobile.
We could block inside useAttachmentPicker, but that hook is also used by normal menu, paste, and drop-zone attachment flows. Keeping the guard in ComposerInput is narrower and aligns with the existing composer edit state.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
applause-bot commentedon Jun 29, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/27c0f7cc02f02c45795623c45ee559f2b24fb74cbe16215bd517f7ffe14d2cf1
KJ21-ENG commentedon Jun 29, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-29 17:07:55 UTC.
Proposal
What is the root cause of that problem?
The mobile edit-comment flow reuses the main report composer. While edit mode replaces the normal attachment action button with edit controls,
ComposerInputstill forwards every pasted file topickAttachments, anduseAttachmentPickerstores confirmed files inattachmentFileRefbefore clearing the composer.App/src/pages/inbox/report/ReportActionCompose/ComposerActionButton.tsx
Lines 6 to 12 in 19f1bb3
App/src/pages/inbox/report/ReportActionCompose/ComposerInput.tsx
Lines 42 to 95 in 19f1bb3
App/src/pages/inbox/report/ReportActionCompose/useAttachmentPicker.ts
Lines 22 to 50 in 19f1bb3
On native, the composer treats non-text clipboard content as a file and calls
onPasteFile, so pasted images can enter the attachment flow even while a comment is being edited.App/src/components/Composer/implementation/index.native.tsx
Lines 97 to 112 in 19f1bb3
When the user taps send/save after that, edit submission only publishes the edited draft when
attachmentFileRefis empty. If that ref is populated, the submit path callsaddAttachmentWithComment, which creates a separate attachment message instead of only saving the edited comment.App/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts
Lines 57 to 87 in 19f1bb3
What changes do you think we should make in order to solve the problem?
In
ComposerInput, read the existing edit state fromuseComposerEditState()and make theonPasteFilehandler return without callingpickAttachments({files})while the composer is editing a message. When the edit state is off, keep the currentpickAttachments({files})behavior unchanged.App/src/pages/inbox/report/ReportActionCompose/ComposerContext.ts
Lines 35 to 46 in 19f1bb3
App/src/pages/inbox/report/ReportActionCompose/ComposerProvider.tsx
Lines 72 to 77 in 19f1bb3
App/src/pages/inbox/report/ReportActionCompose/ComposerInput.tsx
Lines 84 to 95 in 19f1bb3
That keeps normal image/file paste behavior for new comments, but prevents edit-comment mode from opening the attachment preview or populating
attachmentFileRef.App/src/pages/inbox/report/ReportActionCompose/useAttachmentPicker.ts
Lines 22 to 50 in 19f1bb3
Test coverage:
ReportActionComposeUI test for active edit-comment mode that simulates an image/file paste and verifies the attachment preview/navigation is not triggered.What alternative solutions did you explore? (Optional)
We could block pasted files inside
useAttachmentPicker, but the bug is specific to edit-comment mode and the edit state already belongs to the composer layer. Gating theonPasteFilecallback inComposerInputkeeps the attachment picker reusable for normal compose, action-menu, and drop-zone attachment flows.melvin-bot commentedon Jun 29, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (
External)neerajbachani commentedon Jun 29, 2026
proposal
[-]chat-Image paste is allowed in Edit Comment, resulting in a separate attachment message[/-][+][$250] chat-Image paste is allowed in Edit Comment, resulting in a separate attachment message[/+]melvin-bot commentedon Jun 29, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022071637942646065190
github-actions commentedon Jun 29, 2026
nabi-ebrahimi commentedon Jun 29, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 06:44:52 UTC.
Proposal
What is the root cause of that problem?
On native mobile (Android/iOS), editing a comment happens inside the main report composer. The composer tracks edit mode via
isEditingInComposeranddidResetComposerHeightWhileEditing. All composer controls — the action menu, the send button — are already gated on that edit stateComposerActionButton.tsx#L6-L12App/src/pages/inbox/report/ReportActionCompose/ComposerActionButton.tsx
Lines 6 to 12 in 884bbe4
When a user pastes an image while editing, the paste goes straight into the attachment picker
ComposerInput.tsx#L101App/src/pages/inbox/report/ReportActionCompose/ComposerInput.tsx
Line 101 in 884bbe4
attachmentFileRefuseAttachmentPicker.ts#L28-L31https://github.com/Expensify/App/blob/HEAD/src/pages/inbox/report/ReportActionCompose/useAttachmentPicker.ts#L28-L31 When the user taps Send, the submit logic checks that ref: if it is non-empty, it callsaddAttachmentWithCommentinstead ofpublishDraft, creating a brand-new attachment message instead of saving the edituseComposerSubmit.ts#L68-L71https://github.com/Expensify/App/blob/HEAD/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts#L68-L71.The submit logic only treats the operation as an edit when
attachmentFileRefis empty. Once the paste populates that ref, the submit path takes the wrong branch.There is also a stale-state issue: if the user pastes a file in normal compose mode, cancels the attachment preview, then starts editing, the ref is never cleared
useAttachmentPicker.ts#L33-L39App/src/pages/inbox/report/ReportActionCompose/useAttachmentPicker.ts
Lines 33 to 39 in 884bbe4
What changes do you think we should make in order to solve the problem?
Block file attachments at four points, each covering a different failure mode:
At the paste entry point. In
ComposerInputApp/src/pages/inbox/report/ReportActionCompose/ComposerInput.tsx
Line 101 in 884bbe4
isEditingInComposeranddidResetComposerHeightWhileEditing— and make the paste handler return early without calling the attachment picker when either flag is true. This prevents the invalid state before any side effects occur: no validation, no preview navigation, no ref mutation. The paste is silently dropped.Inside the attachment picker. In
useAttachmentPickerApp/src/pages/inbox/report/ReportActionCompose/useAttachmentPicker.ts
Line 61 in 884bbe4
pickAttachmentsat the top. This blocks all attachment entry points during edit mode — paste, drag-and-drop, and any future entry points — at the lowest level. The hook is already coupled to the composer context viauseComposerMeta(), so this is consistent with the existing architecture.On edit mode entry. In
ComposerProviderApp/src/pages/inbox/report/ReportActionCompose/ComposerProvider.tsx
Line 78 in 884bbe4
attachmentFileRefwhenisEditingInComposertransitions to true. This handles the case where the user had a pending attachment from a cancelled preview before entering edit mode.At submit time. In
useComposerSubmitApp/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts
Lines 65 to 72 in 884bbe4
attachmentFileRefand callpublishDraftwhenever the operation is an edit. This is the last line of defense: if any of the three layers above somehow fails, the edit is still published correctly.What alternative solutions did you explore? (Optional)
Guarding only on
isEditingInComposer(withoutdidResetComposerHeightWhileEditing) is insufficient because the submit logic atuseComposerSubmit.ts#L68App/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts
Line 68 in 884bbe4
Hardening the shared native
Composerto conditionally register paste handling targets the wrong component —ReportActionItemMessageEditon desktop, not the mainComposerInputwhere this bug actually occurs on mobile.Adding an
isFocused()guard in the native Composer's paste handler addresses a different concern. The issue is not about focus — it is about the focused main composer forwarding paste during edit mode.Fixed Demo:
video_2026-06-30_11-16-39.mp4
mukhrr commentedon Jun 29, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-29 16:56:30 UTC.
Proposal
What is the root cause of that problem?
The native Android/iOS composer supports file paste through
TextInput’s nativeonPasteevent. When the pasted content is not plain text,index.native.tsxbuilds aFileObject, resolves the file size, and always callsonPasteFile(file):App/src/components/Composer/implementation/index.native.tsx
Lines 97 to 114 in e44b0d5
That callback eventually reaches
ComposerInput, which unconditionally forwards every pasted file to the attachment picker:App/src/pages/inbox/report/ReportActionCompose/ComposerInput.tsx
Line 94 in e44b0d5
The attachment picker stores the pasted file in
attachmentFileRefwhen the user confirms the attachment preview:App/src/pages/inbox/report/ReportActionCompose/useAttachmentPicker.ts
Lines 22 to 24 in e44b0d5
This conflicts with the edit-composer submit logic.
useComposerSubmitpublishes an edit only whenattachmentFileRef.currentis empty. Once paste has populated that ref, Send falls into the attachment branch and callsaddAttachmentWithComment, creating a new text + attachment message:App/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts
Lines 60 to 86 in e44b0d5
History makes the mismatch clearer. Commit
6952c27f29dbextracted attachment handling intouseAttachmentPickerand moved paste handling intoComposerInputwithout edit-mode awareness:6952c27f29db
Then commit
f72149fb793cintroduced/reapplied the new edit composer model where the UI and submit flow are explicitly edit-aware:f72149fb793c
Similar composer controls already respect edit mode:
App/src/pages/inbox/report/ReportActionCompose/ComposerActionButton.tsx
Lines 6 to 12 in e44b0d5
App/src/pages/inbox/report/ReportActionCompose/ComposerSendButton.tsx
Lines 19 to 34 in e44b0d5
So the root cause is that the native paste attachment entry point was left outside the existing edit-mode boundary.
What changes do you think we should make in order to solve the problem?
Gate pasted files in
ComposerInputusing the existingisEditingInComposerstate before they reachuseAttachmentPicker.Small diff sketch:
This fixes the Android/iOS bug because the native
onPastepath still works normally, but edit mode no longer lets pasted images populateattachmentFileRef.To avoid regressions:
index.native.tsx; keep native paste parsing/file-size resolution unchanged.useAttachmentPicker; normal attachment picking, normal image paste, and attachment preview behavior stay the same.isEditingInComposeris true, matching the existing UI rule that hides the attachment action during edit mode.Test coverage:
publishDraft, and pasting during edit does not causeaddAttachmentWithComment.What alternative solutions did you explore? (Optional)
We could block this in
index.native.tsx, but that would put report/edit-composer knowledge into the shared native composer implementation and would only cover mobile.We could block inside
useAttachmentPicker, but that hook is also used by normal menu, paste, and drop-zone attachment flows. Keeping the guard inComposerInputis narrower and aligns with the existing composer edit state.61 remaining items
melvin-bot commentedon Aug 6, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 6, 2026
Payment Summary
Resolving PRs:
Ignore pasted files in the composer while editing a comment #96729
Reviewer: @mukhrr owed $250 via NewDot
Reviewer: @eh2077 owed $250 via NewDot
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Aug 10, 2026
Payment Summary
Contributor: @mukhrr due $250 via NewDot
Contributor+: @eh2077 due $250 via NewDot
^ Test case created. Thx
flaviadefaria commentedon Aug 21, 2026
Approved: @mukhrr due $250 via NewDot
laurenreidexpensify commentedon Sep 4, 2026
$250 approved @eh2077 New Expensify