Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Due payment][$500] IOU - Receipt image is not downloaded in offline mode. #31442

Closed
4 of 6 tasks
kbecciv opened this issue Nov 16, 2023 · 15 comments
Closed
4 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kbecciv
Copy link

kbecciv commented Nov 16, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Open New Expensify app
  2. Enable offline mode.
  3. Click on the FAB button
  4. Click on 'Request Money'
  5. Choose 'Scan' and add a receipt
  6. Choose a workspace
  7. Save money request
  8. Open the IOU details view
  9. Click on the receipt > overflow menu > Download

Note
Reproduced on Desktop. Web, mWeb - the image opens in a new tab. Android - the application is crashing. iOS - "Hmm... it's not here"

Expected Result:

When you attempt to download the receipt image, you should see a window asking you to save it and select a folder on your computer

Actual Result:

Nothing happens when you try to download the image of the receipt

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6279124_1700142064112.Recording__734.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017cd9958133b7f343
  • Upwork Job ID: 1725149444281790464
  • Last Price Increase: 2023-11-16
  • Automatic offers:
    • aimane-chnaif | Reviewer | 27703431
    • mkhutornyi | Contributor | 27703433
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 16, 2023
@melvin-bot melvin-bot bot changed the title IOU - Receipt image is not downloaded in offline mode. [$500] IOU - Receipt image is not downloaded in offline mode. Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

Job added to Upwork: https://www.upwork.com/jobs/~017cd9958133b7f343

Copy link

melvin-bot bot commented Nov 16, 2023

Triggered auto assignment to @kadiealexander (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Nov 16, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (External)

@mkhutornyi
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Local attachment is not downloaded in desktop, opens new tab in web

What is the root cause of that problem?

if (!resolvedUrl.startsWith(ApiUtils.getApiRoot())) {
// Different origin URLs might pose a CORS issue during direct downloads.
// Opening in a new tab avoids this limitation, letting the browser handle the download.
Link.openExternalLink(url);
return Promise.resolve();

Local image url starts with blob: and it's treated as if external url

What changes do you think we should make in order to solve the problem?

If url starts with blob:, don't open external link.
So add more condition:

 if (!resolvedUrl.startsWith(ApiUtils.getApiRoot()) && !resolvedUrl.startsWith('blob:')) { 

@dukenv0307
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Receipt image is not downloaded in offline mode

What is the root cause of that problem?

The bug is introduced in this PR #25556 which opens a new tab when the resolvedUrl doesn't start with ApiRoot

if (!resolvedUrl.startsWith(ApiUtils.getApiRoot())) {

What changes do you think we should make in order to solve the problem?

We shouldn't do that for the local file, we can add a check to not open a new tab for the local file URL by using the same check here.

const isLocalFile = typeof image === 'string' && (image.startsWith('blob:') || image.startsWith('file:')); 
    if (!resolvedUrl.startsWith(ApiUtils.getApiRoot()) && !isLocalFile) {

const isLocalFile = typeof image === 'string' && (image.startsWith('blob:') || image.startsWith('file:'));

if (!resolvedUrl.startsWith(ApiUtils.getApiRoot())) {

What alternative solutions did you explore? (Optional)

@aimane-chnaif
Copy link
Contributor

Thanks for proposals. Both proposals look good.
We can go with @mkhutornyi's proposal as they proposed first.
@dukenv0307's proposal added more condition of file: but native download works already so it's optional fix and more like code dry.
🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Nov 16, 2023

Triggered auto assignment to @techievivek, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

📣 @aimane-chnaif 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Nov 16, 2023

📣 @mkhutornyi 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 17, 2023
@aimane-chnaif
Copy link
Contributor

PR was deployed to production on Nov 22. @kadiealexander this is ready for payment

@kadiealexander
Copy link
Contributor

Sorry for missing this one team!

@kadiealexander
Copy link
Contributor

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@aimane-chnaif] The PR that introduced the bug has been identified. Link to the PR:
  • [@aimane-chnaif] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@aimane-chnaif] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@aimane-chnaif] Determine if we should create a regression test for this bug.
  • [@aimane-chnaif] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@kadiealexander] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@kadiealexander kadiealexander changed the title [$500] IOU - Receipt image is not downloaded in offline mode. [Due payment][$500] IOU - Receipt image is not downloaded in offline mode. Dec 20, 2023
@kadiealexander
Copy link
Contributor

kadiealexander commented Dec 20, 2023

Payouts due:

Upwork job is here.

@kadiealexander kadiealexander added the Daily KSv2 label Dec 20, 2023
@kadiealexander kadiealexander removed the Weekly KSv2 label Dec 20, 2023
@aimane-chnaif
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Handle potential CORS issues during file downloads #25556
  • The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: Handle potential CORS issues during file downloads #25556 (comment)
  • A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N/A
  • Determine if we should create a regression test for this bug. N/A as caught by QA team
  • If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

6 participants