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

Prevent iOS crash when redirect url is null #286

Merged
merged 1 commit into from Jan 18, 2022

Conversation

rmartin48
Copy link

PR Checklist

What is the current behavior?

On iOS, calling openAuth with undefined/null for redirectUrl will crash the app. This issue was recently introduced in this commit where the scheme is being extracted from the redirect url. The result is that escapedRedirectURL = "<null>" which is not a valid URL scheme.

ExceptionsManager.js:179 Exception '*** -[NSURL initWithString:relativeToURL:]: nil string parameter' was thrown while invoking openAuth on target RNInAppBrowser with params (
    "https://xxx.xxx.amazoncognito.com/logout?client_id=xxx&logout_uri=myscheme%3A%2F%2Fpath",
    "<null>",
       ...

What is the new behavior?

Don't attempt to extract the scheme from redirectUrl if it is undefined. Simply pass in nil which will be handled gracefully.

@jdnichollsc
Copy link
Member

jdnichollsc commented Jul 6, 2021

Why redirectUrl is null? I mean, this parameter is not optional 🤔

@jdnichollsc
Copy link
Member

I'm asking because that url is required for Android platform as you can see here https://github.com/proyecto26/react-native-inappbrowser/blob/develop/utils.js#L31

@deermichel
Copy link

I don't know why it's null, but we encounter the same crashes on iOS 👍🏽

@jdnichollsc
Copy link
Member

Please create an issue related to this PR and attach a reproducible demo to understand better your scenario 👍

@jdnichollsc
Copy link
Member

Thanks for your contribution mate! <3

@jdnichollsc jdnichollsc merged commit 7322e18 into proyecto26:develop Jan 18, 2022
@jdnichollsc jdnichollsc mentioned this pull request Jul 29, 2022
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.

None yet

3 participants