Repository navigation
Use the original file name when downloading chat videos - #104072
Conversation
…missing Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
|
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: Then you can close this PR and open a new one from your fork. |
|
🤖 Web test steps verification results: 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.
|
|
@MelvinBot merge main |
…ileName Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
|
The failing checks are unrelated to this PR, so I didn't push any code changes.
All other checks pass on EvidenceThis PR changes only |
|
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 (
All other checks pass. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppCleanShot.2026-10-21.at.21.00.26.4.mp4Android: mWeb ChromeCleanShot.2026-10-21.at.20.55.13.3.mp4iOS: HybridAppCleanShot.2026-10-21.at.21.04.42.5.mp4CleanShot.2026-10-21.at.21.07.10.6.mp4iOS: mWeb SafariCleanShot.2026-10-21.at.20.53.13.2.mp4MacOS: Chrome / SafariCleanShot.2026-10-21.at.20.50.27.1.mp4 |
|
@MelvinBot update the PR description:
|
|
I updated the PR description and marked the PR as ready for review. I made these changes:
Replacing the Tests and QA Steps sections also removed their "Verify that no errors appear in the JS console" checkboxes. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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; |
There was a problem hiding this comment.
Keep collecting video text until the closing tag
When a legacy video filename contains an encoded character, such as <video ...>clip&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 👍 / 👎.
|
The failing checks are still unrelated to this PR, so I didn't push a code change. The PR head (
All other checks pass. |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product
|
@MelvinBot merge main |
…ileName Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
|
🤖 Merged the latest |
|
@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 has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.5.20-0 🚀
|
|
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 |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.20-5 🚀
Bundle Size Analysis (Sentry): |






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 thedata-nameattribute. When it was missing, they used the last part of the source URL, which is the storage key. Server-rendered<video>tags can omitdata-nameand 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:
data-name<video>inner textIn
extractAttachments, the video attachment is still added when its opening tag is parsed, so attachment order doesn't change. Ifdata-nameis missing, the attachment is replaced with one that uses the inner text when that text arrives.Fixed Issues
$ #103993
PROPOSAL: #103993 (comment)
Tests
clip.mp4; also try a video file with no extension)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
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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
npm test -- tests/unit/extractAttachmentsTest.ts tests/unit/VideoRendererTest.tsx tests/ui/ReportAttachments.tsx: 3 suites, 9 tests passed. New tests coverdata-name, inner-text fallback, URL fallback, and text after a<video>tag being ignored.npm run typecheck: passed.npm run linton 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.npm testsuite, fullnpm 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