Not secure urls are transformed to https
This commit is contained in:
parent
ab1ca48fca
commit
f7fe26235a
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "reddit-slideshow",
|
"name": "reddit-slideshow",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "reddit-slideshow",
|
"name": "reddit-slideshow",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
|
@ -137,8 +137,12 @@ class App extends Component {
|
|||||||
/**
|
/**
|
||||||
* Only keep valid urls and extensions.
|
* Only keep valid urls and extensions.
|
||||||
* Returns a valid url or null if url parameter isn't valid.
|
* Returns a valid url or null if url parameter isn't valid.
|
||||||
|
* Not secure urls are transformed to https.
|
||||||
*/
|
*/
|
||||||
filterUrl = (url) => {
|
filterUrl = (url) => {
|
||||||
|
// Transform http to https
|
||||||
|
url = url.replace("http://", "https://");
|
||||||
|
|
||||||
const domain = url.match(/:\/\/(.+)\//)[1];
|
const domain = url.match(/:\/\/(.+)\//)[1];
|
||||||
const extPattern = /\.[0-9a-z]+$/i;
|
const extPattern = /\.[0-9a-z]+$/i;
|
||||||
const match = url.match(extPattern);
|
const match = url.match(extPattern);
|
||||||
|
Loading…
Reference in New Issue
Block a user