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
[Due for payment 2025-11-26] [$250] Android - Scan receipt- Unable to download a receipt in the confirmation page #74685
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Please re-state the problem that we are trying to solve in this issue.
On Android, when uploading a scanned receipt with spaces in the filename, clicking "Download" from the three-dot menu shows an "Unable to download a receipt" error.
What is the root cause of that problem?
The local file URI contains URL-encoded characters (e.g., %20 for spaces), but this encoded URI is passed directly to the filesystem API without decoding.
I'm not able to reproduce this in Browserstack as I don't have access to any files for testing. Since there are proposals of this I'll add External to continue.
changed the title [-]Android - Scan receipt- Unable to download a receipt in the confirmation page[/-][+][$250] Android - Scan receipt- Unable to download a receipt in the confirmation page[/+]on Nov 10, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.60-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@mananjadhav@Christinadobrzyn The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
@Christinadobrzyn I think we should have an existing regression test for this. If it's this specific case then we should just update the test case to cover URL with spaces. What do you think?
Activity
melvin-bot commentedon Nov 10, 2025
Triggered auto assignment to @Christinadobrzyn (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.nkdengineer commentedon Nov 10, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Unable to download a receipt error shown
What is the root cause of that problem?
The local source can contain URL-encoded characters
And we pass this soure here without decoded the URI, the error appears because we can't find the file with this URI.
App/src/libs/fileDownload/index.android.ts
Line 83 in 29b9755
What changes do you think we should make in order to solve the problem?
We should decode the URI first
App/src/libs/fileDownload/index.android.ts
Line 49 in 29b9755
What alternative solutions did you explore? (Optional)
We can hide the download option for the local file here even if
draftTransactionIDeixstsApp/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx
Line 177 in 29b9755
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
TaduJR commentedon Nov 10, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Android, when uploading a scanned receipt with spaces in the filename, clicking "Download" from the three-dot menu shows an "Unable to download a receipt" error.
What is the root cause of that problem?
The local file URI contains URL-encoded characters (e.g.,
%20for spaces), but this encoded URI is passed directly to the filesystem API without decoding.The file URI is URL-encoded:
But the actual filename has spaces:
At line 49, the URL-encoded URI is assigned without decoding:
App/src/libs/fileDownload/index.android.ts
Line 49 in 5dc4f0c
This encoded path is then passed to
copyToMediaStoreat line 83:App/src/libs/fileDownload/index.android.ts
Lines 76 to 84 in 5dc4f0c
The API interprets
%20as literal characters instead of an encoded space, resulting in "No such file" error.What changes do you think we should make in order to solve the problem?
Decode the URI at line 49:
App/src/libs/fileDownload/index.android.ts
Line 49 in 5dc4f0c
Before:
After:
This decodes URL-encoded characters (
%20→ space) so the path matches the actual filename on disk.Why
decodeURI()instead ofdecodeURIComponent():Both functions decode URL-encoded characters, but they handle reserved characters differently:
decodeURI(): Designed for complete URIs. Decodes%20,%23, etc., but preserves/(won't decode%2F)decodeURIComponent(): Designed for URI components. Decodes everything including%2F→/Advantages of
decodeURI()for file URIs:Preserves path structure - Won't decode
%2Fto/, preventing potential directory traversal issuesfolder%2Ffile,decodeURIComponent()would incorrectly decode it tofolder/file, changing the directory structuredecodeURI()keeps it asfolder%2Ffile, matching the actual filenameSemantically correct - Designed for complete URIs (like file paths), not URI components (like query parameters)
Safer for edge cases - While Android sanitizes
/in filenames, defensive coding prevents issues if this changes or in unexpected scenariosMatches existing codebase pattern - Consistency improves code quality:
App/src/libs/fileDownload/checkFileExists/index.ts
Lines 15 to 20 in 5dc4f0c
Christinadobrzyn commentedon Nov 10, 2025
I'm not able to reproduce this in Browserstack as I don't have access to any files for testing. Since there are proposals of this I'll add External to continue.
melvin-bot commentedon Nov 10, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021987936396746461489
[-]Android - Scan receipt- Unable to download a receipt in the confirmation page[/-][+][$250] Android - Scan receipt- Unable to download a receipt in the confirmation page[/+]melvin-bot commentedon Nov 10, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (
External)TaduJR commentedon Nov 10, 2025
Hello @Christinadobrzyn
Please use PDF file that have spaces on the filename.
You can reliably reproduce after that
Thank you
21 remaining items
melvin-bot commentedon Nov 19, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.60-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-11-26. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Nov 19, 2025
@mananjadhav @Christinadobrzyn The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Christinadobrzyn commentedon Nov 19, 2025
@mananjadhav do we need a regression test?
mananjadhav commentedon Nov 19, 2025
@Christinadobrzyn I think we should have an existing regression test for this. If it's this specific case then we should just update the test case to cover URL with spaces. What do you think?
Christinadobrzyn commentedon Nov 24, 2025
It looks like this is the current regression test:
Step 01
For scanning, you can use a personal receipt file or download a test file here
Result:
@mananjadhav can you confirm the above looks good?
Christinadobrzyn commentedon Nov 24, 2025
Payment summary here - #74685 (comment)
TaduJR commentedon Nov 25, 2025
Thank you @Christinadobrzyn
Offer Accepted.
Christinadobrzyn commentedon Nov 26, 2025
nudge @mananjadhav to review the regression test proposal here - #74685 (comment)
mananjadhav commentedon Nov 26, 2025
Missed this @Christinadobrzyn. I think one additional line would be -
Upload the file that has spaces in the filename.Christinadobrzyn commentedon Nov 26, 2025
Ok regression test - https://github.com/Expensify/Expensify/issues/572357
Payment summary here - #74685 (comment)
Closing!
quinthar commentedon Nov 30, 2025
$250 approved to @mananjadhav