Repository navigation
Conversation
Compare a draft label against the attachment tag it came from rather than the original filename, so an edit that leaves the label alone never renames the queued file, and keep data-name in sync when a rename is applied. Also stop the rename from blanking a name or dropping the uri and source the native upload path reads off the file, and fall back to the source basename so a multipart part is never sent unnamed. Co-authored-by: Shubham Agrawal <shubham1206agra@users.noreply.github.com>
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
Wrap the data-name replace() call across lines to match oxfmt's output so the Oxfmt check no longer reports a diff. Co-authored-by: Shubham Agrawal <shubham1206agra@users.noreply.github.com>
|
Fixed and pushed. The only real failure was Oxfmt check — The other red check, DetailsFailure output: Diff (whitespace only): - const labelledHtml = uploadingAttachmentHtml.replace(new RegExp(`${CONST.ATTACHMENT_ORIGINAL_FILENAME_ATTRIBUTE}="[^"]*"`, 'i'), `${CONST.ATTACHMENT_ORIGINAL_FILENAME_ATTRIBUTE}="${label}"`);
+ const labelledHtml = uploadingAttachmentHtml.replace(
+ new RegExp(`${CONST.ATTACHMENT_ORIGINAL_FILENAME_ATTRIBUTE}="[^"]*"`, 'i'),
+ `${CONST.ATTACHMENT_ORIGINAL_FILENAME_ATTRIBUTE}="${label}"`,
+ );AI tests re-run locally on the fix commit:
|
|
🤖 Android test steps verification results: Steps 1-4 pass on standalone Android NewDot: the offline text+attachment message sends as one pending message, long-press offers Edit comment, and the edit keeps both the new text and the attachment under its original name. Step 5 fails — after going back online the queued Notes for the authorScope: standalone Android NewDot (developmentDebug APK, emulator), App checked out on The PR's rename path was never exercised. The attachment label was left unchanged, so The blocker is in the send path, not the edit path, and it reproduces with no edit at all. Lead (not confirmed root cause): the queued Also worth a look for the original "renamed to Test residue: two failed pending messages remain in the test account's self DM. |
|
🤖 Web test steps verification results: Only step 1 passed. Steps 2-5 could not be run on web: the harness's browser driver documents file uploads as out of scope, so the attachment at the centre of this repro could never be added, and the report-action context menu was unreachable (right-click and long-press both return What this means, and what would actually verify itBe clear about the status: this run produced no evidence for or against the fix on web. Do not read the ❌ marks as the bug reproducing — they mark steps that could not be executed. The repro needs a browser the test harness fully owns, so Playwright can both Two harness gaps this surfaced, worth fixing if web testing of attachment flows is meant to work at all:
The attempt to work around the first gap by attaching Playwright to the live session is the most likely cause of the browser teardown. That went beyond the driver's documented scope and cost the session. For what it's worth, the Android run did exercise this. On [Test branch] Keep an edited attachment name from collapsing to the form field name I reported earlier that steps 1-4 pass on Android but the queued view run · no recording available |














Explanation of Change
This is a test branch requested on the linked issue, not a finished fix.
Keep a file attachment intact when its comment is edited was reverted from
mainind805f83while the linked issue was being triaged. This branch re-lands it and then hardens the attachment rename path that the issue reported, so both the original feature and the reported bug can be tested together.Two commits, kept separate so the second is reviewable on its own:
editReportCommentdecided whether an edit renamed the attachment by comparing the draft's markdown label against thedata-nameattribute, butapplyLabelToUploadingAttachmentHtmlonly rewrote the anchor's inner text. Once those two disagreed, every later edit re-renamed the queued file from whatever the label happened to be. The comparison now uses the tag's own current label (newgetUploadingAttachmentLabelhelper), which makes it idempotent, andapplyLabelToUploadingAttachmentHtmlkeepsdata-namein sync so the tag no longer contradicts itself.renameQueuedAttachmentnow returns the file untouched when the label is empty. A multipart part sent without a filename is stored under the form field name, which is how an attachment ends up calledfile.renameQueuedAttachmentrebuilds aFileto change its name, which silently dropped the non-standarduriandsourceproperties the app hangs off file objects.prepareRequestPayload/index.native.tsreadssourceto find the file on disk, so losing it changes the native upload path. They are now carried across the rebuild.prepareRequestPayload/index.native.tsfalls back to thesourcebasename so a part is never appended unnamed.Unit tests were added for the idempotence of the label comparison, for
uri/sourcesurviving the rebuild, and for an empty label leaving the queued filename alone.Caveat for the reviewer: the analysis behind this pinned the mechanism to the rename path with medium confidence. Walking a first, text-only edit by hand, the draft label and the tag label are equal, so the rename should not fire at all — which means either the label diverges somewhere in the native live-markdown edit composer, or the multipart filename arrives blank and the server falls back to the field name. These changes close both routes, but the repro should be re-run on a device to confirm which one it was.
Fixed Issues
$ #101744
PROPOSAL: #101744 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review".
// Please describe what tests you performed that validate your change worked.
Offline tests
// TODO: The human co-author must fill out the offline tests you ran before marking this PR as "ready for review".
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
// TODO: The human co-author must fill out the QA tests before marking this PR as "ready for review".
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.AI Tests
Run locally by MelvinBot on this branch:
npm test -- tests/unit/RequestConflictUtilsTest.tsnpm test -- tests/unit/ReportUtilsTest.tsnpm test -- tests/actions/ReportTest.ts tests/unit/getAttachmentDetailsTest.ts tests/unit/FileUtilsTest.tsnpm run typechecknpm run lint-changednpm run spell-changedNot run:
npm run storybook -- --smoke-test --ciand the fullnpm testsuite. Directnpx eslintonsrc/libs/ReportUtils.tsandsrc/libs/actions/Report/index.tsreports only pre-existing violations grandfathered by the seatbelt ratchet; none fall on the changed lines.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari