react-native-pinch icon indicating copy to clipboard operation
react-native-pinch copied to clipboard

Unsafe cast causing a crash on Android when an http URL is erroneously used

Open pierrerafiq opened this issue 7 years ago • 0 comments

In android HTTPUtil.java:

HttpsURLConnection connection; URL url = new URL(request.endpoint); String method = request.method.toUpperCase(); line 81: connection = (HttpsURLConnection) url.openConnection();

If the request.endpoint is erroneously http, url.Connection() will return an HttpURLConnection object. The forced cast will cause a runtime exception/crash.

Ideally the code should check for the URL prefix before doing a cast.

pierrerafiq avatar Oct 25 '17 06:10 pierrerafiq