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

[HOLD for payment 2024-06-13] [$250] App crashes when adding / at the end of URL #41806

Closed
1 of 6 tasks
m-natarajan opened this issue May 7, 2024 · 32 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented May 7, 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: 1.4.71-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: @ishpaul777
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1715030970069889

Action Performed:

1.sign out if already signed in
2. add a extra / in end of url "https://staging.new.expensify.com//"

Expected Result:

App shouldn't crash

Actual Result:

App crashes

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

Recording.6.mp4
Screen.Recording.2024-05-07.at.2.53.28.AM.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d6865a1fa1e14235
  • Upwork Job ID: 1790449044293632000
  • Last Price Increase: 2024-05-14
  • Automatic offers:
    • ishpaul777 | Contributor | 0
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @alexpensify
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 7, 2024
Copy link

melvin-bot bot commented May 7, 2024

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

@melvin-bot melvin-bot bot added the Overdue label May 10, 2024
@alexpensify
Copy link
Contributor

On my testing list, I'll get to it soon.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 10, 2024
@alexpensify
Copy link
Contributor

I wasn't able to get to this one over the weekend, still on my radar.

@melvin-bot melvin-bot bot removed the Overdue label May 13, 2024
@alexpensify alexpensify added the External Added to denote the issue can be worked on by a contributor label May 14, 2024
@melvin-bot melvin-bot bot changed the title App crashes when adding / at the end of URL [$250] App crashes when adding / at the end of URL May 14, 2024
Copy link

melvin-bot bot commented May 14, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 14, 2024
Copy link

melvin-bot bot commented May 14, 2024

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

@alexpensify
Copy link
Contributor

Actually, after testing this again. I see the failure if you input https://staging.new.expensify.com// but it does not fail when you go to new.expensify.com// or https://new.expensify.com//. I'm actually going to close this since users don't access staging, only engineers, contributors, and BugZero team.

@ishpaul777
Copy link
Contributor

ishpaul777 commented May 14, 2024

Hey @alexpensify i can repro. on prod

trim.AC678369-D837-4FF2-97B3-F5840584AA31.MOV

@alexpensify
Copy link
Contributor

Reopening again since this does appear to be an issue on mobile browsers when trying to access https://new.expensify.com//

@alexpensify alexpensify reopened this May 14, 2024
@alexpensify alexpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels May 14, 2024
Copy link

melvin-bot bot commented May 14, 2024

Current assignee @Santhosh-Sellavel is eligible for the External assigner, not assigning anyone new.

@alexpensify
Copy link
Contributor

Tomorrow, I'll create a new Upwork job.

@dominictb
Copy link
Contributor

dominictb commented May 15, 2024

Proposal

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

App crashes when adding / at the end of URL

What is the root cause of that problem?

When we use the URL //, react-navigation will try to save it to window history here, this leads to the crash because the browser will inteprete it as containing the protocol already (// will be interpreted as https://, //abc will be interpreted as https://abc/). It's called scheme-relative URL (more details here).

For regular URLs like /r/1234, the browser will consider it as not having both the protocol and domain and will append the protocol and domain of the current URL to it so it becomes https://staging.new.expensify.com/r/1234 and doesn't have the issue.

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

We need to sanitize the URL first before trying to save it to react-navigation.

We already have the method to remove redundant slashes here, so can just use that on the pathWithHash.

Pseudocode to test:

}, '', pathWithHash.replace(/(\/{2,})|(\/$)/g, (match, p1) => (p1 ? '/' : '')));

We can do that here or can do it even earlier when retrieving the path, such as in getPathForRoute

What alternative solutions did you explore? (Optional)

Some potential improvements of the above approach:

  • If after sanitizing, the path is / then we can early return rather than saving to window history, as it's the root path already
  • Improve the sanitization logic to avoid matching // if it's after the protocol (http, https://, ...), but I believe this case won't happen because react-navigation should've done that for us already

@alexpensify
Copy link
Contributor

@Santhosh-Sellavel - can you please confirm if this proposal will fix this issue? Thanks!

@Santhosh-Sellavel Santhosh-Sellavel removed their assignment May 16, 2024
@ishpaul777
Copy link
Contributor

ishpaul777 commented May 16, 2024

Taking this over as c+ https://expensify.slack.com/archives/C02NK2DQWUX/p1715883803397859

@ishpaul777
Copy link
Contributor

ishpaul777 commented May 17, 2024

Thanks for assigning @alexpensify,I'll evaluate the proposal within 24 hours

@melvin-bot melvin-bot bot added the Overdue label May 20, 2024
@ishpaul777
Copy link
Contributor

Proposal from @dominictb LGTM and also tests well!

Screen.Recording.2024-05-20.at.10.14.57.PM.mov

🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label May 20, 2024
Copy link

melvin-bot bot commented May 20, 2024

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

Copy link

melvin-bot bot commented May 20, 2024

📣 @dominictb You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

Copy link

melvin-bot bot commented May 21, 2024

@tgolen @alexpensify @ishpaul777 @dominictb this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels May 22, 2024
@alexpensify
Copy link
Contributor

Looking at the PR, @ishpaul777 is offline until tomorrow and will review then.

@alexpensify
Copy link
Contributor

Update: It looks like this PR is moving along. We're waiting for the final approval from someone who will be offline until Monday.

@alexpensify
Copy link
Contributor

Weekly Update: The PR got the needed review, so we are moving forward.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 6, 2024
@melvin-bot melvin-bot bot changed the title [$250] App crashes when adding / at the end of URL [HOLD for payment 2024-06-13] [$250] App crashes when adding / at the end of URL Jun 6, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 6, 2024
Copy link

melvin-bot bot commented Jun 6, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Jun 6, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.79-11 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 2024-06-13. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jun 6, 2024

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:

  • [@ishpaul777] The PR that introduced the bug has been identified. Link to the PR:
  • [@ishpaul777] 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:
  • [@ishpaul777] 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:
  • [@ishpaul777] Determine if we should create a regression test for this bug.
  • [@ishpaul777] 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.
  • [@alexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 12, 2024
@alexpensify
Copy link
Contributor

Okay, we're all set for the payment date. @dominictb, I've sent a new request in Upwork. Please accept, and I'll complete the payment process. Thanks!

@dominictb
Copy link
Contributor

@alexpensify I accepted it, thanks

@alexpensify
Copy link
Contributor

Paid via Upwork!

Payouts due: 2024-06-13

Upwork job is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

6 participants