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
[$125] Attachment - Unable to submit or share large pdf file via native app #67908
Version Number: V9.1.89-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail:https://test-management.browserstack.com/projects/2219752/folder/13176721/test-cases/41236970 Email or phone of affected tester (no customers): Slottwo1 7423@gmail.com Issue reported by: Applause Internal Team Device used: Redminote 10s android 13 phone App Component: Chat Report View
Action Performed:
Keep app logged in
Open a large pdf - send - select expensify app
Select a chat
Try to submit/ share the file
Expected Result:
User must be able to submit or share file via native app.
Actual Result:
Unable to submit or share large pdf file and error is also not shown when action cannot be performed.
Please re-state the problem that we are trying to solve in this issue.
Unable to submit or share any PDF file (either large or small), and the error is also not shown when the action cannot be performed. Also, the attachment preview is not shown at step 4.
What is the root cause of that problem?
When we try to submit or share any PDF file to the chat selected in step 3, the Share button doesn't work, and the Attachment Preview of the PDF file is empty, as can be seen in this screenshot:
It happens because both AttachmentModal(used to show preview) and handleShare(called when tapping Share) function relies on validFilesToUpload state. In this case, the validFilesToUpload === 0 and handleShare returns because of this condition here:
However, we do not call the proceedWithFilesAction function passed as setValidFilesToUpload from the ShareDetailsPage, like we do for the processedFiles here:
Hence, the validFilesToUpload remains empty even though the file was validated, resulting in broken Attachment Preview and Share button not working.
What changes do you think we should make in order to solve the problem?
To solve the issue, we just need to call the proceedWithFilesAction here:
.then(({processedFiles, pdfsToLoad})=>{if(pdfsToLoad.length){validFiles.current=processedFiles;setPdfFilesToRender(pdfsToLoad);proceedWithFilesAction(pdfsToLoad);// set the validFilesToUpload
However, seeing the complexity of the useFilesValidation hook, we should look for if we need the other checks as we are doing for processedFiles here:
But, if we look at the flow of operation for the PDF file, then those checks seems redundant for pdfFilesToRender. Anyways, we can discuss this at the PR phase for sure :)
Results: Now, the Share button works and Attachment Preview is shown.
Screen_recording_20250806_005027.mp4
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
I don't think we have tests for Share flow.
What alternative solutions did you explore? (Optional)
As an alternative, we can make use of the PDFValidationComponent exported from the useFilesValidation hook, as it calls the checkIfAllValidatedAndProceed function when PDF loaded successfully:
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.
changed the title [-]Attachment - Unable to submit or share large pdf file via native app[/-][+][$250] Attachment - Unable to submit or share large pdf file via native app[/+]on Aug 5, 2025
changed the title [-][$250] Attachment - Unable to submit or share large pdf file via native app[/-][+][$125] Attachment - Unable to submit or share large pdf file via native app[/+]on Sep 2, 2025
Activity
melvin-bot commentedon Aug 5, 2025
Triggered auto assignment to @OfstadC (
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.rohit9625 commentedon Aug 5, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Unable to submit or share any PDF file (either large or small), and the error is also not shown when the action cannot be performed. Also, the attachment preview is not shown at step 4.
What is the root cause of that problem?
When we try to submit or share any PDF file to the chat selected in step 3, the
Sharebutton doesn't work, and the Attachment Preview of the PDF file is empty, as can be seen in this screenshot:It happens because both
AttachmentModal(used to show preview) andhandleShare(called when tapping Share) function relies onvalidFilesToUploadstate. In this case, the validFilesToUpload === 0 andhandleSharereturns because of this condition here:App/src/pages/Share/ShareDetailsPage.tsx
Lines 107 to 110 in 8aca992
And
AttachmentModaldoesn't show any preview becausesource(validFilesToUpload.at(0))doesn't exists:App/src/pages/Share/ShareDetailsPage.tsx
Lines 212 to 215 in 8aca992
Let's see why the
validFilesToUploadwas empty?Look at this code block:
App/src/pages/Share/ShareDetailsPage.tsx
Lines 58 to 70 in 8aca992
validFilesToUploadstate updates in theuseFilesValidationhook as we passsetValidFilesToUploadto the hookvalidateFilesfunction which is called inside the aboveuseEffectwhen theShareDetailsPagemounted, after selecting a chat at step 3currentAttachmentto thevalidateFilesfunction, and it callsvalidateAndResizeFilesas the files.length is 1:App/src/hooks/useFilesValidation.tsx
Line 278 in afef073
validateAndResizeFilescallsisValidfor each file, which further callsnormalizeFileObjectand so on.App/src/hooks/useFilesValidation.tsx
Lines 237 to 241 in afef073
proceedWithFilesActionfunction passed assetValidFilesToUploadfrom theShareDetailsPage, like we do for the processedFiles here:App/src/hooks/useFilesValidation.tsx
Lines 258 to 262 in afef073
Hence, the
validFilesToUploadremains empty even though the file was validated, resulting in broken Attachment Preview and Share button not working.What changes do you think we should make in order to solve the problem?
To solve the issue, we just need to call the
proceedWithFilesActionhere:However, seeing the complexity of the
useFilesValidationhook, we should look for if we need the other checks as we are doing forprocessedFileshere:App/src/hooks/useFilesValidation.tsx
Lines 246 to 252 in afef073
But, if we look at the flow of operation for the PDF file, then those checks seems redundant for pdfFilesToRender. Anyways, we can discuss this at the PR phase for sure :)
Results: Now, the
Sharebutton works and Attachment Preview is shown.Screen_recording_20250806_005027.mp4
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
I don't think we have tests for
Shareflow.What alternative solutions did you explore? (Optional)
As an alternative, we can make use of the
PDFValidationComponentexported from theuseFilesValidationhook, as it calls thecheckIfAllValidatedAndProceedfunction when PDF loaded successfully:App/src/hooks/useFilesValidation.tsx
Lines 328 to 332 in c7c0583
Which further calls:
App/src/hooks/useFilesValidation.tsx
Lines 171 to 173 in c7c0583
We can make these changes at the
ShareDetailsPagefile: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.
[-]Attachment - Unable to submit or share large pdf file via native app[/-][+][$250] Attachment - Unable to submit or share large pdf file via native app[/+]melvin-bot commentedon Aug 5, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021952841206235305205
melvin-bot commentedon Aug 5, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (
External)melvin-bot commentedon Aug 8, 2025
@suneox Whoops! This issue is 2 days overdue. Let's get this updated quick!
suneox commentedon Aug 9, 2025
The alternative solution from @rohit9625 LGTM. We can apply the same approach that's already used in the existing IOU request flow.
🎀 👀 🎀 C+ reviewed
20 remaining items
melvin-bot commentedon Aug 28, 2025
@suneox Eep! 4 days overdue now. Issues have feelings too...
rohit9625 commentedon Aug 30, 2025
Hi @OfstadC, I think we should retest this issue and proceed with further steps :)
melvin-bot commentedon Sep 1, 2025
@suneox Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
OfstadC commentedon Sep 2, 2025
I've confirmed we'd pay $125 here so working on payment now
rohit9625 commentedon Sep 2, 2025
Well, I just received an offer with amount $150. Do you want to edit that?
OfstadC commentedon Sep 2, 2025
Sorry @rohit9625 - I just updated to $125 - https://www.upwork.com/nx/wm/offer/108635230
rohit9625 commentedon Sep 2, 2025
No problem, I accepted the new offer. Thank you :)
[-][$250] Attachment - Unable to submit or share large pdf file via native app[/-][+][$125] Attachment - Unable to submit or share large pdf file via native app[/+]melvin-bot commentedon Sep 2, 2025
OfstadC commentedon Sep 2, 2025
Payment Summary
garrettmknight commentedon Sep 30, 2025
$125 approved for @suneox