From 66a9e9d1a15e149ebdfa5a2e9cca06aaa3f29835 Mon Sep 17 00:00:00 2001 From: jainkuniya Date: Mon, 3 Jun 2019 21:41:16 +0530 Subject: [PATCH] iOS: Fix crash on following a link with non-ASCII characters. The `SafariView` library apparently crashes when passed a `url` parameter that isn't all ASCII. Strictly such a thing isn't a URL (or URI), in fact, but rather an "IRI": https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier Fix the issue by encoding the IRI in ASCII as a proper URI/URL. The standard JS function `encodeURI` does the job. Fixes: #3315 [greg: expanded commit message] --- src/utils/openLink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/openLink.js b/src/utils/openLink.js index 2e1aa744d50..ee9144dbd03 100644 --- a/src/utils/openLink.js +++ b/src/utils/openLink.js @@ -4,7 +4,7 @@ import SafariView from 'react-native-safari-view'; export default (url: string): void => { if (Platform.OS === 'ios') { - SafariView.show({ url }); + SafariView.show({ url: encodeURI(url) }); } else { NativeModules.CustomTabsAndroid.openURL(url); }