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
Android - Unable to send an MP3 file through the share menu #96933
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #95518 - "feat: Enable react-native-nitro-fetch (V3)" by @chrispader (High confidence) Related Issues: Previously reverted iterations of the same feature: #88110 (V1) and #94469 (V2, reverted via #95284 which is also on this deploy)
Recommendation: REVERT
This PR globally replaces the native fetch implementation with react-native-nitro-fetch (an HTTP/Cronet client), and the Share send path reads the local file via fetch(file://…) — a scheme NitroFetch does not handle like RN's default fetch — so the MP3 blob comes back empty on Android and the send silently no-ops. Reverting restores the working native fetch for local file reads; this feature has already been reverted twice (V1/V2), so a clean revert is the safest path while the file-URI handling is fixed.
Assigned: @chrispader (PR author), @roryabraham and @mkhutornyi (approving reviewers) Labels: No label changes. DeployBlockerCash kept (an App PR caused the regression; App deploy remains blocked). No DeployBlocker (Web) label was present.
📋 Detailed Analysis
Evidence
The bug is Android-only and reproduces on staging v9.4.44-0 but not production — a regression introduced by a PR on this deploy.
Comparing production...staging, none of the Share pages (ShareRootPage.tsx, ShareDetailsPage.tsx, getFileSize), FileUtils.ts, addAttachmentWithComment, the native FileIntentHandler.kt/ShareActionHandlerModule.kt, or SHARE_FILE_MIMETYPE (which already lists audio/mpeg and audio/mp3) were changed. So the MIME gate and the send helpers themselves are not the regression.
The PR body explicitly states: "By globally replacing fetch, Headers, Request, and Response on native, existing fetch(...) callsites and dependencies keep the same API while routing through NitroFetch" and "the changes in this PR affect all network requests across the whole app." On web the vanilla fetch is retained — consistent with the bug being native/Android-only.
Affected send path — ShareDetailsPage.handleShare → readFileAsync in src/libs/fileDownload/FileUtils.ts, which reads the local file blob via fetch:
constreadFileAsync: ReadFileAsync=(path,fileName,onSuccess,onFailure=()=>{},fileType='')=>newPromise((resolve)=>{if(!path){resolve();onFailure('[FileUtils] Path not specified');return;}fetch(path)// path is a local file:// / content:// URI.then((res)=>{// fetch is "Unable to read uploaded file" on Android even though the blob is returned,// so we'll ignore in that caseif(!res.ok&&Platform.OS!=='android'){throwError(res.statusText);}res.blob().then((blob)=>{constfile=newFile([blob],cleanFileName(fileName),{type: blob.type||fileType});
...
Note the code already tolerates non-OK responses on Android (line ignores !res.ok), so when NitroFetch cannot read the file:///content:// blob the flow proceeds with an empty/invalid blob, and the attachment upload produces nothing — matching the reported "tap Send → nothing sends."
Confirmed via gh pr view 95518 --json files that feat: Enable react-native-nitro-fetch (V3) #95518 adds src/polyfills/NitroFetch.ts, src/polyfills/NitroFetch.web.ts, the react-native-nitro-fetch patch, and modifies index.js, src/libs/HttpUtils.ts, src/libs/Request.ts, and the Android native networking files — i.e. it owns the global native fetch that readFileAsync depends on.
react-native-nitro-fetch is a native HTTP client (Cronet on Android). After #95518 replaces globalThis.fetch with it on native, any fetch() against a local file:// / content:// URI — as used by readFileAsync to load the shared MP3 into a Blob before upload — no longer returns the file's bytes the way RN's default fetch did. The resulting empty/invalid blob means the attachment is never actually uploaded, so tapping Send does nothing on Android. Web is unaffected because it keeps the browser's native fetch.
Exact changed line that breaks MP3 sending (from #95518): src/polyfills/NitroFetch.ts:7 → globalThis.fetch = nitroFetch; (installed first via index.js: import './src/polyfills/NitroFetch';), which redirects the fetch(path) call in readFileAsync (src/libs/fileDownload/FileUtils.ts:265) away from the native file-URI-capable fetch.
The Android share flow decides whether a shared file is "allowed" solely from the mime type the sending app declares in the intent — it never falls back to the file extension. So an MP3 shared by an app that declares a generic or non‑standard mime (e.g. application/octet-stream, audio/x-mpeg, or an empty type) is rejected before it can be sent, even though it is a valid .mp3.
The chain:
The native handler stores the intent's mime verbatim: FileIntentHandler.kt:26 passes intent.type straight into ShareFileObject. The extension is only used to name the copied file (FileUtils.kt:100), never to derive the mime.
The JS gate then rejects anything whose mime isn't an exact string match in CONST.SHARE_FILE_MIMETYPE: ShareRootPage.tsx:108-112. On failure it shows the wrongFileType / notAllowedExtension alert and routes back to the Inbox — i.e. "the MP3 is not sent."
audio/mpeg and audio/mp3are in the allowlist (CONST/index.ts:2745-2750), so the failure only happens when the source app declares a mime that isn't one of those exact strings. Because the gate has no extension fallback, a correctly‑named .mp3 still gets blocked.
Rest of the flow is fine — evidence
The send path itself handles audio correctly, which is why the failure is at the gate and not later:
Preview: MP3 is not video/image/PDF, so AttachmentPreview.tsx:139 falls through to DefaultAttachmentView — no onLoadError, no spurious "corrupt attachment" alert.
readFileAsync already has an Android fallback to the caller‑supplied fileType and tolerates the Android fetch quirk: FileUtils.ts:270-277.
Size limits (24 MB max / 240 B min) are not the cause for a normal MP3: CONST/index.ts:347-355.
Confidence: Medium. The mechanism and code path are confirmed by static analysis, but I could not confirm the exact mime string the tester's MP3 carried. Worth confirming: on the failing device, log tempFile.mimeType at ShareRootPage.tsx:108 (or intent.type in FileIntentHandler) — if it's anything other than audio/mpeg / audio/mp3, this is confirmed.
What changes do you think we should make in order to solve the problem?
Make the mime resolution extension‑aware so a valid .mp3 isn't blocked by a mislabeled or missing intent type:
In the native handler, when intent.type is null/empty or generic (application/octet-stream/*/*), derive the mime from the file extension via MimeTypeMap.getMimeTypeFromExtension(...) before storing it (FileIntentHandler.kt / ShareActionHandlerModule.kt). MimeTypeMap is already imported in FileUtils.kt.
As a JS safety net, when the incoming mime isn't in SHARE_FILE_MIMETYPE, fall back to mapping the file extension (already computed at ShareRootPage.tsx:140) to an allowed mime before showing the wrongFileType error.
This keeps the change entirely within the App repo (native Android + JS) and preserves the existing allowlist as the source of truth.
What alternative solutions did you explore? (Optional)
If the confirmation step above shows the mime is actually audio/mpeg/audio/mp3 (already allowed) and the file still fails to upload after the gate, the failure would be on the HybridApp/backend send path rather than in App — that would need a separate internal investigation, since it's outside this repo.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/96933) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Activity
applause-bot commentedon Jul 24, 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/bc4ca38e816d20b4e56d8fab64960b19091e0d754e131fdfed23ec0c865098a2
melvin-bot commentedon Jul 24, 2026
Triggered auto assignment to @Julesssss (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Jul 24, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Jul 24, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
MelvinBot commentedon Jul 24, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #95518 - "feat: Enable
react-native-nitro-fetch(V3)" by @chrispader (High confidence)Related Issues: Previously reverted iterations of the same feature: #88110 (V1) and #94469 (V2, reverted via #95284 which is also on this deploy)
Recommendation: REVERT
This PR globally replaces the native
fetchimplementation withreact-native-nitro-fetch(an HTTP/Cronet client), and the Share send path reads the local file viafetch(file://…)— a scheme NitroFetch does not handle like RN's default fetch — so the MP3 blob comes back empty on Android and the send silently no-ops. Reverting restores the working nativefetchfor local file reads; this feature has already been reverted twice (V1/V2), so a clean revert is the safest path while the file-URI handling is fixed.Assigned: @chrispader (PR author), @roryabraham and @mkhutornyi (approving reviewers)
Labels: No label changes.
DeployBlockerCashkept (an App PR caused the regression; App deploy remains blocked). NoDeployBlocker(Web) label was present.📋 Detailed Analysis
Evidence
The bug is Android-only and reproduces on staging v9.4.44-0 but not production — a regression introduced by a PR on this deploy.
Comparing
production...staging, none of the Share pages (ShareRootPage.tsx,ShareDetailsPage.tsx,getFileSize),FileUtils.ts,addAttachmentWithComment, the nativeFileIntentHandler.kt/ShareActionHandlerModule.kt, orSHARE_FILE_MIMETYPE(which already listsaudio/mpegandaudio/mp3) were changed. So the MIME gate and the send helpers themselves are not the regression.I scanned every PR on the v9.4.44
StagingDeployCashchecklist (Deploy Checklist: New Expensify 2026-07-23 #96914). The only one that alters the shared network/file-read path is feat: Enablereact-native-nitro-fetch(V3) #95518, which addssrc/polyfills/NitroFetch.tsand wires it as the first polyfill inindex.js:The PR body explicitly states: "By globally replacing fetch, Headers, Request, and Response on native, existing
fetch(...)callsites and dependencies keep the same API while routing through NitroFetch" and "the changes in this PR affect all network requests across the whole app." On web the vanillafetchis retained — consistent with the bug being native/Android-only.This exact feature has been shipped and reverted twice already (V1 feat: Enable
react-native-nitro-fetch#88110, V2 feat: Enablereact-native-nitro-fetch(V2) #94469 reverted by [CP Staging + Prod] Revert "feat: Enable react-native-nitro-fetch (V2)" #95284), indicating a history of regressions from the globalfetchswap.Verification
ShareDetailsPage.handleShare→readFileAsyncinsrc/libs/fileDownload/FileUtils.ts, which reads the local file blob viafetch:!res.ok), so when NitroFetch cannot read thefile:///content://blob the flow proceeds with an empty/invalidblob, and the attachment upload produces nothing — matching the reported "tap Send → nothing sends."gh pr view 95518 --json filesthat feat: Enablereact-native-nitro-fetch(V3) #95518 addssrc/polyfills/NitroFetch.ts,src/polyfills/NitroFetch.web.ts, thereact-native-nitro-fetchpatch, and modifiesindex.js,src/libs/HttpUtils.ts,src/libs/Request.ts, and the Android native networking files — i.e. it owns the global nativefetchthatreadFileAsyncdepends on.Root Cause
react-native-nitro-fetchis a native HTTP client (Cronet on Android). After #95518 replacesglobalThis.fetchwith it on native, anyfetch()against a localfile:///content://URI — as used byreadFileAsyncto load the shared MP3 into aBlobbefore upload — no longer returns the file's bytes the way RN's default fetch did. The resulting empty/invalid blob means the attachment is never actually uploaded, so tapping Send does nothing on Android. Web is unaffected because it keeps the browser's nativefetch.Exact changed line that breaks MP3 sending (from #95518):
src/polyfills/NitroFetch.ts:7→globalThis.fetch = nitroFetch;(installed first viaindex.js:import './src/polyfills/NitroFetch';), which redirects thefetch(path)call inreadFileAsync(src/libs/fileDownload/FileUtils.ts:265) away from the native file-URI-capable fetch.MelvinBot commentedon Jul 24, 2026
Proposal
What is the root cause of that problem?
The Android share flow decides whether a shared file is "allowed" solely from the mime type the sending app declares in the intent — it never falls back to the file extension. So an MP3 shared by an app that declares a generic or non‑standard mime (e.g.
application/octet-stream,audio/x-mpeg, or an empty type) is rejected before it can be sent, even though it is a valid.mp3.The chain:
FileIntentHandler.kt:26passesintent.typestraight intoShareFileObject. The extension is only used to name the copied file (FileUtils.kt:100), never to derive the mime.CONST.SHARE_FILE_MIMETYPE:ShareRootPage.tsx:108-112. On failure it shows thewrongFileType/notAllowedExtensionalert and routes back to the Inbox — i.e. "the MP3 is not sent."audio/mpegandaudio/mp3are in the allowlist (CONST/index.ts:2745-2750), so the failure only happens when the source app declares a mime that isn't one of those exact strings. Because the gate has no extension fallback, a correctly‑named.mp3still gets blocked.Rest of the flow is fine — evidence
The send path itself handles audio correctly, which is why the failure is at the gate and not later:
AttachmentPreview.tsx:139falls through toDefaultAttachmentView— noonLoadError, no spurious "corrupt attachment" alert.readFileAsyncalready has an Android fallback to the caller‑suppliedfileTypeand tolerates the Androidfetchquirk:FileUtils.ts:270-277.CONST/index.ts:347-355.Confidence: Medium. The mechanism and code path are confirmed by static analysis, but I could not confirm the exact mime string the tester's MP3 carried. Worth confirming: on the failing device, log
tempFile.mimeTypeatShareRootPage.tsx:108(orintent.typeinFileIntentHandler) — if it's anything other thanaudio/mpeg/audio/mp3, this is confirmed.What changes do you think we should make in order to solve the problem?
Make the mime resolution extension‑aware so a valid
.mp3isn't blocked by a mislabeled or missing intent type:intent.typeis null/empty or generic (application/octet-stream/*/*), derive the mime from the file extension viaMimeTypeMap.getMimeTypeFromExtension(...)before storing it (FileIntentHandler.kt/ShareActionHandlerModule.kt).MimeTypeMapis already imported inFileUtils.kt.SHARE_FILE_MIMETYPE, fall back to mapping the file extension (already computed atShareRootPage.tsx:140) to an allowed mime before showing thewrongFileTypeerror.This keeps the change entirely within the App repo (native Android + JS) and preserves the existing allowlist as the source of truth.
What alternative solutions did you explore? (Optional)
If the confirmation step above shows the mime is actually
audio/mpeg/audio/mp3(already allowed) and the file still fails to upload after the gate, the failure would be on the HybridApp/backend send path rather than in App — that would need a separate internal investigation, since it's outside this repo.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/96933)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
mkhutornyi commentedon Jul 24, 2026
I am not able to reproduce this locally
Julesssss commentedon Jul 24, 2026
Reverting and requested CPs here
Julesssss commentedon Jul 24, 2026
Requested QA here now that reverts hit staging
m-natarajan commentedon Jul 25, 2026
Unable to repro, Pixel 4/Android 13, v9.4.44-6
az_recorder_20260724_211107.mp4
yuwenmemon commentedon Jul 25, 2026
Thanks @m-natarajan !