Skip to content

Commit d00bdb9

Browse files
hyunjongLfacebook-github-bot
authored andcommittedSep 29, 2018
Resolve protocol http, https when not in lowercase (#21396)
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
1 parent ee03459 commit d00bdb9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎Libraries/Linking/Linking.js

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ class Linking extends NativeEventEmitter {
5757
* See https://facebook.github.io/react-native/docs/linking.html#openurl
5858
*/
5959
openURL(url: string): Promise<any> {
60+
// Android Intent requires protocols http and https to be in lowercase.
61+
// https:// and http:// works, but Https:// and Http:// doesn't.
62+
if (url.toLowerCase().startsWith('https://')) {
63+
url = url.replace(url.substr(0, 8), 'https://');
64+
} else if (url.toLowerCase().startsWith('http://')) {
65+
url = url.replace(url.substr(0, 7), 'http://');
66+
}
6067
this._validateURL(url);
6168
return LinkingManager.openURL(url);
6269
}

0 commit comments

Comments
 (0)