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

Resolve protocol http, https when not in lowercase #21396

Closed
wants to merge 4 commits into from

Conversation

hyunjongL
Copy link
Contributor

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.

Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!

Test Plan:

Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!

I have added to my react native app that has to open URLs with protocols(Https) that have uppercases. Added console log of the url back and forth to test if the url has changed.
You can easily build an react-native app like https://snack.expo.io/@hyunjongl/android-linking-protocol-problem and see if this resolves it.
image
This is the screenshot of the console log where I try to open a URL with Https, and the code will automatically change it into https.

Release Notes:

Fixes #21395
[ANDROID][ENHANCEMENT][Libraries/Linking/Linking.js]
https://snack.expo.io/@hyunjongl/android-linking-protocol-problem

There issue is that when you have a URL with protocol that has an uppercase, it works in iOS, but won't work in Android. (check the Expo above).
There are a lot of user generated URLs in social platforms, and I bet it is not a good Idea to change what the user have wrote. Also currently I feel like iOS and Android behave differently in this issue which makes me feel bad.
So, I am suggesting a way to change the protocol['http://', 'https://'] into lowercase just before opening the browser. However, as I am very new to this community, it might not be the best place to add the lines, so comments are very welcome.

TL;DR Added few lines to change the protocol string to lowercase when some are in uppercase.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 28, 2018
Copy link

@analysis-bot analysis-bot left a comment

Choose a reason for hiding this comment

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

eslint found some issues. You may run yarn prettier or npm run prettier to fix these.

Libraries/Linking/Linking.js Outdated Show resolved Hide resolved
Libraries/Linking/Linking.js Outdated Show resolved Hide resolved
@react-native-bot react-native-bot added 🌐Networking Related to a networking API. ✅Test Plan Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. labels Sep 28, 2018
@hyunjongL
Copy link
Contributor Author

Can someone help me understand why one of the tests have failed?

Copy link
Contributor

@RSNara RSNara left a comment

Choose a reason for hiding this comment

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

Nice catch!

This is almost ready to merge. I just have a few nits, and one question.

Libraries/Linking/Linking.js Outdated Show resolved Hide resolved
Libraries/Linking/Linking.js Outdated Show resolved Hide resolved
Libraries/Linking/Linking.js Outdated Show resolved Hide resolved
@RSNara
Copy link
Contributor

RSNara commented Sep 28, 2018

@hyunjongL I don't think your PR broke CI. So, I wouldn't worry about it.

@hyunjongL
Copy link
Contributor Author

@RSNara check out the changes!

@RSNara
Copy link
Contributor

RSNara commented Sep 29, 2018

Thanks for the quick fixes! I'll merge this.

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Sep 29, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

RSNara is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

@hyunjongL merged commit d00bdb9 into facebook:master.

@facebook facebook locked as resolved and limited conversation to collaborators Sep 29, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Sep 29, 2018
kelset pushed a commit that referenced this pull request Oct 12, 2018
Summary:
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.

_Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_
Pull Request resolved: #21396

Differential Revision: D10119630

Pulled By: RSNara

fbshipit-source-id: d0fe193eee976b9b18a2eb467b5f3af48bd7d2de
@hramos hramos removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 6, 2019
t-nanava pushed a commit to microsoft/react-native-macos that referenced this pull request Jun 17, 2019
Summary:
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.

_Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_
Pull Request resolved: facebook#21396

Differential Revision: D10119630

Pulled By: RSNara

fbshipit-source-id: d0fe193eee976b9b18a2eb467b5f3af48bd7d2de
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. 🌐Networking Related to a networking API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android - Linking won't openURL with uppercase in protocol http/https
6 participants