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

Krishna2323/issue/49286 #813

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Krishna2323
Copy link
Contributor

@Krishna2323 Krishna2323 commented Oct 15, 2024

Fixed Issues

$ GH_LINK Expensify/App#49286

Details: This PR updates the sanitizeURL utility function to accept a new parameter, scheme. The scheme parameter allows us to specify the scheme as needed. The default value is https, but we can pass http or any other scheme as the scheme parameter to override it.

Tests

  1. What unit/integration tests cover your change? What autoQA tests cover your change?
  2. What tests did you perform that validates your changed worked?

QA

  1. What does QA need to do to validate your changes?
  2. What areas to they need to test for regressions?

Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
@Krishna2323 Krishna2323 requested a review from a team as a code owner October 15, 2024 19:02
@melvin-bot melvin-bot bot requested review from rlinoz and removed request for a team October 15, 2024 19:03
* @returns The formatted URL
*/
sanitizeURL(url: string): string {
sanitizeURL(url: string, scheme = 'https'): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sanitizeURL(url: string, scheme = 'https'): string {
sanitizeURL(url: string, defaultScheme = 'https'): string {

Copy link
Contributor

@ahmedGaber93 ahmedGaber93 Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think defaultScheme is more meaningful because it uses only as a default value if the URL didn't have a scheme. We also need to update the comment and its usage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also add a unit to confirm that

expect(Str.sanitizeURL('https://example.com', 'http')).toBe('https://example.com');

@marcaaron marcaaron requested review from marcaaron and removed request for rlinoz October 16, 2024 22:12
@marcaaron
Copy link
Contributor

@rlinoz I'll take over as I'm assigned to the parent issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants