vault-development / react-native-svg-uri

Render SVG images in React Native from an URL or static file
850 stars 334 forks source link

unisigned https #144

Open EvanGeminika opened 5 years ago

EvanGeminika commented 5 years ago

Is it possible to svg stream from unsigned https ? I've test below code with http, and I can get the svg successfully: <SvgUri width="200" height="200" source={{ uri: "http://192.168.1.1:3000/captcha" }}

But, when I use unisgned https (in my test environment), I get "ERROR",{} Below is my code: <SvgUri width="200" height="200" source={{ uri: "https://192.168.1.1/captcha" }}

Is there any way to get svg stream from unsigned https ?

fniwes commented 5 years ago

Unfortunately there is no easy way to do it.

My suggestion, use a valid certificate for your development environment. You can get one for free from https://letsencrypt.org/

This plugin uses fetch api to retrieve the svg file. An alternative could be to use the api exposed by this plugin: https://github.com/joltup/rn-fetch-blob and do some code changes in react-native-svg-uri to allow whitelisting of domains. But I am not sure if this is a good idea for this plugin, and security in general.

EvanGeminika commented 5 years ago

Yup, I've use react-native-fetch-blob and, and update index.js like below:

const response = await this.getSvgUri(uri);

It's working as expected. Thanks for your comment.