fix: use MIME type to detect pasted images in attachment preview - #99920
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@ZhenjaHorbach 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] |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product
|
@mhawryluk |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2026-09-02.12.52.31.movAndroid: mWeb Chrome2026-09-02.12.52.31.moviOS: HybridApp2026-09-02.12.55.18.moviOS: mWeb Safari2026-09-02.12.54.26.movMacOS: Chrome / Safari2026-09-02.12.49.51.mov |
|
LGTM! |
|
@mhawryluk Could you merge main in? The failing jest test should be fixed by the PR #100205 |
|
@inimaga done! |
|
🚧 inimaga 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/inimaga in version: 9.4.70-0 🚀
|
|
No help site changes are required for this PR, so I did not create a docs PR. This is a defect fix, not a behavior or feature change. Why no article needs updating
Per the help site guidelines, articles describe what a customer needs to do, not internal detection logic. There is no step, screen, or label a customer would follow differently after this change. @mhawryluk, please confirm you agree no help site update is needed here. If you think a customer-facing article should cover pasting images into chat as a new topic, reply and I'll draft it. |
|
🚀 Deployed to staging by https://github.com/inimaga in version: 9.4.72-0 🚀
|
|
🤖 No help site changes are required for this PR. I did not create a docs PR. Why: This is an internal bug fix, not a behavior or feature change users can read about. What I checked in
|
Explanation of Change
Pasting an image copied from Google Docs app on Android showed it as a document in the preview, instead of an image.
checkIsFileImagedecided image vs document by extension only, checking the source URI and the filename, and ignoring the file's MIME type. Web has a dedicated paste branch for Google Workspace images that fetches the bytes and names the fileimage.jpg, so the check passed there. Native has no equivalent branch: both signals come from the clipboard content URI, which carries no usable extension, so the check failed and the document layout rendered.The check now also reads
FileObject.type. The MIME subtype is routed throughStr.isImagerather than matched as a bareimage/prefix, so it stays limited to the formats React Native can render and does not admit SVG, HEIC, or TIFF.Fixed Issues
$ #99736
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
Same as tests.
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.Screenshots/Videos
Android: Native
Nagranie.z.ekranu.2026-09-1.o.13.10.01.mov
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Nagranie.z.ekranu.2026-09-1.o.13.12.37.mov