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

[$250] Attachment - I'm navigated to "about:blank" after downloading a docx attachment #52572

Closed
1 of 8 tasks
lanitochka17 opened this issue Nov 14, 2024 · 24 comments
Closed
1 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Design External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 14, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.62-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5223403&group_by=cases:section_id&group_id=292107&group_order=asc
Issue reported by: Applause - Internal Team

Action Performed:

  1. Navigate to https://staging.new.expensify.com/
  2. Log in with a Gmail account
  3. Navigate to a 1:1 DM
  4. Send a docx attachment
  5. Tap on the download icom
  6. Tap on "Download"

Expected Result:

1:1 DM should open after downloading

Actual Result:

I'm navigated to "about:blank" after downloading a docx attachment

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6665142_1731586622942.YAST9638.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021859608263768238021
  • Upwork Job ID: 1859608263768238021
  • Last Price Increase: 2024-11-21
  • Automatic offers:
    • Krishna2323 | Contributor | 105027213
Issue OwnerCurrent Issue Owner: @hungvu193
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 14, 2024
Copy link

melvin-bot bot commented Nov 14, 2024

Triggered auto assignment to @CortneyOfstad (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.

@Krishna2323
Copy link
Contributor

Proposal


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

Attachment - I'm navigated to "about:blank" after downloading a docx attachment

What is the root cause of that problem?

  • The logic in asyncOpenURL opens a new window using window.open(); but that won't be closed automatically when the file is downloaded or rejected. The logic was added to resolve this issue but I don't think we need the custom logic incase of file downloads.
    /**
    * Prevents Safari from blocking pop-up window when opened within async call.
    * @param shouldSkipCustomSafariLogic When true, we will use `Linking.openURL` even if the browser is Safari.
    */
    const asyncOpenURL: AsyncOpenURL = (promise, url, shouldSkipCustomSafariLogic) => {
    if (!url) {
    return;
    }
    const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
    if (!isSafari || shouldSkipCustomSafariLogic) {
    promise
    .then((params) => {
    Linking.openURL(typeof url === 'string' ? url : url(params));
    })
    .catch(() => {
    Log.warn('[asyncOpenURL] error occured while opening URL', {url});
    });
    } else {
    const windowRef = window.open();
    promise
    .then((params) => {
    if (!windowRef) {
    return;
    }
    windowRef.location = typeof url === 'string' ? url : url(params);
    })
    .catch(() => {
    windowRef?.close();
    Log.warn('[asyncOpenURL] error occured while opening URL', {url});
    });
    }
    };

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


We have several options to resolve the issue..

Note

We will thoroughly check the behaviour after implementing the solution in asyncOpenURL or fileDownload function.
We should also check all the instances where we use asyncOpenURL or openExternalLink.

What alternative solutions did you explore? (Optional)

Result

@melvin-bot melvin-bot bot added the Overdue label Nov 18, 2024
Copy link

melvin-bot bot commented Nov 18, 2024

@CortneyOfstad Whoops! This issue is 2 days overdue. Let's get this updated quick!

@CortneyOfstad
Copy link
Contributor

Unable to login to my test accounts 🙃 I enter the magic code and the site doesn't respond in staging. Going to create a bug report.

@melvin-bot melvin-bot bot removed the Overdue label Nov 18, 2024
@CortneyOfstad
Copy link
Contributor

Already reported here!

@melvin-bot melvin-bot bot added the Overdue label Nov 21, 2024
@CortneyOfstad
Copy link
Contributor

Testing now!

@melvin-bot melvin-bot bot removed the Overdue label Nov 21, 2024
@CortneyOfstad
Copy link
Contributor

Was able to recreate. The download option provides the abount:blank link, but the view option works fine, as shown below:

RecordIt-1732199985.MP4

@CortneyOfstad CortneyOfstad added the External Added to denote the issue can be worked on by a contributor label Nov 21, 2024
Copy link

melvin-bot bot commented Nov 21, 2024

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

@melvin-bot melvin-bot bot changed the title Attachment - I'm navigated to "about:blank" after downloading a docx attachment [$250] Attachment - I'm navigated to "about:blank" after downloading a docx attachment Nov 21, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 21, 2024
Copy link

melvin-bot bot commented Nov 21, 2024

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

@hungvu193
Copy link
Contributor

@Krishna2323 I don't think we should remove that specific logic for Safari.
About your second and third option, Can you make sure it won't introduce CORS issue, I think this was mentioned in here:

// 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.

@Krishna2323
Copy link
Contributor

@hungvu193, I don't face any CORS and if you are asking about my second solution then it will still open the download alert on new window but we will skip our custom logic for safari mWeb. The custom logic for safari was added to resolve this issue.

safari_download.mp4

@hungvu193
Copy link
Contributor

Thanks @Krishna2323. Your proposal here LGTM! Let's go with your second option.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Nov 22, 2024

Triggered auto assignment to @grgia, 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 22, 2024
Copy link

melvin-bot bot commented Nov 22, 2024

📣 @Krishna2323 🎉 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 📖

@grgia
Copy link
Contributor

grgia commented Nov 22, 2024

Assigned!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 23, 2024
@CortneyOfstad
Copy link
Contributor

@Krishna2323 any updates on finalizing the PR? Thanks!

@Krishna2323
Copy link
Contributor

@CortneyOfstad, I started a thread on Slack to discuss potential solutions. The solution I proposed in my comment isn’t working for all file types, and I completely missed testing that because I assumed all types of attachments would behave in a similar manner.

@CortneyOfstad
Copy link
Contributor

Thread is still being discussed on best path forward

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Dec 17, 2024
Copy link

melvin-bot bot commented Dec 17, 2024

This issue has not been updated in over 15 days. @CortneyOfstad, @hungvu193, @grgia, @Krishna2323 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!

@Krishna2323
Copy link
Contributor

UPDATE: We are still discussing about the fix on slack.

@CortneyOfstad
Copy link
Contributor

Hey @Krishna2323 and @hungvu193 — just a heads up that I will be OOO starting this afternoon (December 20th) and will be returning January 6th. A handful of folks on the BZ team will be online for a few days in between the 25th and the 1st, but we'll be operating with a skeleton crew. If any action is needed during that time from a BZ perspective, please post this issue in #expensify-open-source and someone on the team will jump in. Otherwise I will review when I am back in office.

Thank you!

Copy link

melvin-bot bot commented Jan 7, 2025

Triggered auto assignment to @dannymcclain (Design), see these Stack Overflow questions for more details.

@grgia
Copy link
Contributor

grgia commented Jan 8, 2025

We've chatted here and decided to Do Nothing for now. Big shout out to @Krishna2323 for testing and coordinating the convo, thanks!

I'm gonna go ahead and close this one out. Cheers.

@grgia grgia closed this as completed Jan 8, 2025
@Krishna2323
Copy link
Contributor

@grgia @CortneyOfstad, I believe we should be compensated the full amount because the proposal was reviewed by @hungvu193. I raised the PR, tried multiple times to find other solutions, and also presented one on Slack, all of which have taken a considerable amount of time.

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. Design External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

6 participants