Skip to content

Use the original file name when downloading chat videos - #104072

Merged
yuwenmemon merged 4 commits into
mainfrom
claude-videoDownloadFileName
Oct 22, 2026
Merged

yuwenmemon merged 4 commits into
mainfrom
claude-videoDownloadFileName

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Downloading a chat video could save it under the storage key (w_<hash>) instead of the uploaded file name.

The inline video's Download menu (VideoRenderer) and the attachment modal (extractAttachments) took the name only from the data-name attribute. When it was missing, they used the last part of the source URL, which is the storage key. Server-rendered <video> tags can omit data-name and keep the original file name only as their inner text. The report action context menu already reads the name from that inner text (getAttachmentDetails).

This PR makes both paths use the name in this order:

  1. data-name
  2. The <video> inner text
  3. The file name from the URL, as before

In extractAttachments, the video attachment is still added when its opening tag is parsed, so attachment order doesn't change. If data-name is missing, the attachment is replaced with one that uses the inner text when that text arrives.

Fixed Issues

$ #103993
PROPOSAL: #103993 (comment)

Tests

  1. Open any chat and upload a video (e.g. clip.mp4; also try a video file with no extension)
  2. Wait until the message is sent and no longer pending
  3. Hover the inline video, open its three-dot menu and tap Download.
  4. Verify the downloaded file name contain the original uploaded file name, not w_<hash> (the download timestamp suffix, e.g. clip_51.610.mp4, is expected)

Offline tests

N/A. Downloads require a connection; this change only affects how the downloaded file name is chosen.

QA Steps

Same as tests

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

AI Tests

  • npm test -- tests/unit/extractAttachmentsTest.ts tests/unit/VideoRendererTest.tsx tests/ui/ReportAttachments.tsx: 3 suites, 9 tests passed. New tests cover data-name, inner-text fallback, URL fallback, and text after a <video> tag being ignored.
  • npm run typecheck: passed.
  • npm run lint on the 4 changed files: passed.
  • npm run fmt (oxfmt): no changes.
  • npm run spell-changed: 0 issues.
  • npm run react-compiler-compliance-check check src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx: passed.
  • Not run locally: the full npm test suite, full npm run lint, and the Storybook smoke test. CI runs these.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

MelvinBot and others added 2 commits October 15, 2026 10:21
…missing

Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team October 15, 2026 10:27
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Oct 15, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch because I don't have push access to your fork.

To take ownership of this branch and push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-videoDownloadFileName
git checkout -b claude-videoDownloadFileName upstream/claude-videoDownloadFileName
git push -u origin claude-videoDownloadFileName

Then you can close this PR and open a new one from your fork.

@MelvinBot

MelvinBot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ⚠️ partial

The PR's Tests section is still a TODO, so I used the reproduction steps from the linked issue. Downloads from the long-press menu and the attachment modal both kept the original file name. However, I couldn't create a video file without an extension on the emulator, so I tested a regular .mp4. That upload probably includes data-name, so the new inner-text fallback wasn't exercised.
Downloaded dialog after attachment modal Download

Step Status
Launch the app and sign inThe Home screen shows the signed-in test user with the Inbox, Spend, Workspaces, and Account tabs.
Home screen signed in
✅
Upload a video file without an extension in a chatI uploaded agent-device-recording-1792060763558.mp4 to the self-DM, and the video message rendered. The tester couldn't make a file without an extension: it had no shell access, and the in-app file picker can't rename files. This edge case is not verified.
Video attachment message in self-DM
❌
Download the uploaded videoThe long-press menu's Download option and the attachment modal's Download icon each showed “Downloaded! Attachment successfully downloaded!”
Downloaded dialog after long-press Download
Downloaded dialog after attachment modal Download
✅
Check the downloaded file name/sdcard/Download/Expensify/ contains agent-device-recording-1792060763558-2026-10-15 10_42_51.610.mp4. That is the original name plus a timestamp suffix to avoid a name collision. The folder has no w_<hash> file.
Download/Expensify folder with original file name
✅

view run · view recording

@MelvinBot

MelvinBot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

I signed in on web, but I couldn't run the upload or download steps. My web test tool doesn't support file uploads or browser downloads, so this run didn't test the fix. The PR's Tests section is still a TODO, so I used the reproduction steps from the linked issue.
Signed-in Home screen on web

Step Status
Launch the app and sign inI finished onboarding and reached the signed-in Home screen with the Home, Inbox, Spend, Workspaces, and Account tabs.
Signed-in Home screen on web
✅
Upload a video file without an extension in a chatNot run. My web test tool can't attach a local file to the chat composer.
❌
Download the video from the video's Download menu and the attachment modalNot run. No video was uploaded, and my web test tool can't trigger or capture browser downloads.
❌
Check that the downloaded file name matches the uploaded name, not w_<hash>Not run. My web test tool can't read a download's suggested file name.
❌

view run · view recording

@suneox

suneox commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot merge main

…ileName

Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Merged main into claude-videoDownloadFileName with no conflicts and pushed it (0d7b341).


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing checks are unrelated to this PR, so I didn't push any code changes.

  • build (Debug, true) (Remote Build Android): Gradle couldn't download com.mapbox.base:common:0.12.0 because repo.grails.org returned 429 Too Many Requests. This was a temporary rate limit on a Maven repository. The other Android variant, build (developmentDebug, false), passed on the same commit. To fix it, rerun the failed job: run 39611217173.
  • Check independent approval: This check is waiting for a reviewer's approval. It isn't a code failure.

All other checks pass on 0d7b341, including ESLint, TypeScript, Jest, Reassure, and Knip.

Evidence

This PR changes only extractAttachments.ts, VideoRenderer.tsx, and their unit tests. It doesn't change any Android, Gradle, or dependency files. From the failed build log:

> Could not GET 'https://repo.grails.org/grails/core/com/mapbox/base/common/0.12.0/common-0.12.0.pom'. Received status code 429 from server: Too Many Requests
> There are 200 more failures with identical causes.
RockError: Failed to build the app. See the error above for details from Gradle.

view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing checks still aren't caused by this PR's code, so I didn't push a fix. The PR is still on the same commit (0d7b341) as my previous comment.

  • build (Debug, true): Gradle got 429 Too Many Requests from repo.grails.org while downloading a Mapbox dependency. This is a temporary rate limit on a download server. To clear it, rerun the failed job in run 39611217173. I don't have permission to start the rerun.
  • Check independent approval: This check passes after a reviewer approves the PR.

All other checks pass.


view run

@suneox

suneox commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
CleanShot.2026-10-21.at.21.00.26.4.mp4
Android: mWeb Chrome
CleanShot.2026-10-21.at.20.55.13.3.mp4
iOS: HybridApp
CleanShot.2026-10-21.at.21.04.42.5.mp4
CleanShot.2026-10-21.at.21.07.10.6.mp4
iOS: mWeb Safari
CleanShot.2026-10-21.at.20.53.13.2.mp4
MacOS: Chrome / Safari
CleanShot.2026-10-21.at.20.50.27.1.mp4

@suneox

suneox commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot update the PR description:

  1. Replace the Tests section with:
    1. Open any chat and upload a video (e.g. `clip.mp4`; also try a video file with no extension)
    2. Wait until the message is sent and no longer pending
    3. Hover the inline video, open its three-dot menu and tap Download. 
    4. Verify the downloaded file name contain the original uploaded file name, not `w_<hash>` (the download timestamp suffix, e.g. `clip_51.610.mp4`, is expected)
  1. Set Offline tests to: N/A. Downloads require a connection; this change only affects how the downloaded file name is chosen.
  2. Set QA Steps to: Same as tests
  3. Check all items in the PR Author Checklist.
  4. Mark the PR as ready for review.

@MelvinBot
MelvinBot marked this pull request as ready for review October 21, 2026 14:23
@MelvinBot
MelvinBot requested a review from a team as a code owner October 21, 2026 14:23
@melvin-bot
melvin-bot Bot requested review from suneox and removed request for a team October 21, 2026 14:24
@melvin-bot

melvin-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

@suneox Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I updated the PR description and marked the PR as ready for review. I made these changes:

  • Tests: replaced with your 4 steps.
  • Offline tests: set to the N/A note.
  • QA Steps: set to "Same as tests".
  • PR Author Checklist: checked every item.

Replacing the Tests and QA Steps sections also removed their "Verify that no errors appear in the JS console" checkboxes.


view run

@melvin-bot
melvin-bot Bot requested review from joekaufmanexpensify and removed request for a team October 21, 2026 14:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T14:27:54.851963Z 0d7b341 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d7b341f6a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


const videoIndex = attachments.indexOf(videoAwaitingFileName);
attachments[videoIndex] = {...videoAwaitingFileName, file: {...videoAwaitingFileName.file, name: innerText}};
videoAwaitingFileName = undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep collecting video text until the closing tag

When a legacy video filename contains an encoded character, such as <video ...>clip&amp;demo.mp4</video>, htmlparser2 may invoke ontext multiple times for that single text node; its documentation explicitly says consumers may need to stitch the pieces together (htmlparser2 usage). Clearing videoAwaitingFileName after the first nonempty callback therefore records only clip, losing both the rest of the name and its extension. Accumulate the callbacks and assign the filename when </video> is reached instead.

Useful? React with 👍 / 👎.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing checks are still unrelated to this PR, so I didn't push a code change. The PR head (0d7b341) hasn't changed since my last check.

  • build (Debug, true) (Remote Build Android): This check hasn't been rerun since it failed. It failed because repo.grails.org returned 429 Too Many Requests when Gradle downloaded a Mapbox dependency. To clear it, rerun the failed job in run 39611217173 with Re-run failed jobs. I don't have permission to rerun it.
  • Check independent approval: This check is waiting for a reviewer's approval. It isn't a code failure.

All other checks pass.


view run

@joekaufmanexpensify joekaufmanexpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good for product

@suneox

suneox commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot merge main

…ileName

Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner October 22, 2026 05:42
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Merged the latest main (439f896aa73) into this branch with no conflicts, and pushed the result as merge commit 15658b79104. The PR diff is the same as before: 4 files changed.


view run

@melvin-bot
melvin-bot Bot requested review from yuwenmemon and removed request for a team October 22, 2026 05:42
@melvin-bot

melvin-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

@yuwenmemon Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@yuwenmemon
yuwenmemon merged commit 45145fc into main Oct 22, 2026
42 checks passed
@yuwenmemon
yuwenmemon deleted the claude-videoDownloadFileName branch October 22, 2026 06:43
@github-actions

Copy link
Copy Markdown
Contributor

🚧 yuwenmemon has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.5.20-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed. This bug fix makes downloaded chat videos keep their original file name, which is what users already expect, and no article in docs/articles describes video download file names.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.20-5 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 failure ❌

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants