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
[$1000] Attachment - No feedback or error message when choosing invalid image file to be sent on chat #19728
Select an invalid or corrupted image file from the file explorer(you can create invalid image file by changing any .txt or .pdf file to .jpg simply or you can find sample invalid image attached in thread)
Observe the infinite loading
Expected Result:
The app should display a feedback or error message indicating that the file is not valid or just upload and send as a file without trying to display preview(if the image file is invalid)
Actual Result:
The app does not show any feedback or error message and tries to preview the image file with infinite loading
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
Version Number: 1.3.19.2
Reproducible in staging?: yes
Reproducible in production?: yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Please re-state the problem that we are trying to solve in this issue.
For corrupt files, we're showing an infinite loader in the Attachment View.
What is the root cause of that problem?
The root cause of this issue is that we're not validating the file types correctly (based on the magic headers, more about this approach in the alternate section). This causes corrupt files to go through to the AttachmentView component. Further more, in the ImageView component, we're also not using the onError callback like we're using on the PDFView component.
What changes do you think we should make in order to solve the problem?
The simplest solution (without magic header check) is to add a onError handler to the ImageView component here. I'm not sure how the UI should look like exactly once error is encountered but we can keep the error in state and if its true, we can render a message here.
What alternative solutions did you explore? (Optional)
The real solution for this sort of issue IMO is to check the file type based on magic headers of the file instead of relying on the file type extracted from the name. The code for this was added in this PR some time ago but the team decided not to add frontend validation of files until another issue came up.
changed the title [-]Attachment - No feedback or error message when choosing invalid image file to be sent on chat[/-][+][$1000] Attachment - No feedback or error message when choosing invalid image file to be sent on chat[/+]on Jun 1, 2023
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Activity
melvin-bot commentedon May 28, 2023
Triggered auto assignment to @sonialiap (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon May 28, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)allroundexperts commentedon May 28, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
For corrupt files, we're showing an infinite loader in the Attachment View.
What is the root cause of that problem?
The root cause of this issue is that we're not validating the file types correctly (based on the magic headers, more about this approach in the alternate section). This causes corrupt files to go through to the
AttachmentViewcomponent. Further more, in the ImageView component, we're also not using theonErrorcallback like we're using on thePDFViewcomponent.What changes do you think we should make in order to solve the problem?
The simplest solution (without magic header check) is to add a
onErrorhandler to theImageViewcomponent here. I'm not sure how the UI should look like exactly once error is encountered but we can keep theerrorin state and if itstrue, we can render a message here.What alternative solutions did you explore? (Optional)
The real solution for this sort of issue IMO is to check the file type based on magic headers of the file instead of relying on the file type extracted from the name. The code for this was added in this PR some time ago but the team decided not to add frontend validation of files until another issue came up.
For reference, here's how Slack deals with a
jpgextension file that is actually a text file:https://github.com/Expensify/App/assets/30054992/bffbd3ed-6d9e-4d85-a06c-001ad31050f4
[-]Attachment - No feedback or error message when choosing invalid image file to be sent on chat[/-][+][$1000] Attachment - No feedback or error message when choosing invalid image file to be sent on chat[/+]melvin-bot commentedon Jun 1, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01764cde9077e5564b
melvin-bot commentedon Jun 1, 2023
Current assignee @sonialiap is eligible for the External assigner, not assigning anyone new.
melvin-bot commentedon Jun 1, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (
External)melvin-bot commentedon Jun 1, 2023
Triggered auto assignment to @marcaaron (
External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.162 remaining items
melvin-bot commentedon Jan 8, 2024
This issue has not been updated in over 15 days. @youssef-lr, @sonialiap, @aimane-chnaif eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Mar 5, 2024
@youssef-lr, @sonialiap, @aimane-chnaif, this Monthly task hasn't been acted upon in 6 weeks; closing.
If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.
mallenexpensify commentedon Nov 11, 2025
Payment Summary
Contributor+: @aimane-chnaif paid $500 via Upwork.
KALLL commentedon Nov 12, 2025
@aimane-chnaif @kbecciv @sonialiap @mallenexpensify @MariaHCD Glad to see this issue resolved. I reported this issue, I am waiting to be paid as the issue reporter, thanks for your consideration.
aimane-chnaif commentedon Nov 12, 2025
@KALLL We ended up not fixing as not a priority
KALLL commentedon Nov 12, 2025
@aimane-chnaif Ohh sorry, I thought it is resolved when I see the payment summary above.