Check that wurl is scalar, before checking for curl

This commit is contained in:
Richard Lewis 2017-08-01 12:00:03 +01:00
parent 596efb6062
commit 5f8e86197f

View file

@ -19,7 +19,7 @@ export default class AppPermission extends React.Component {
const searchParams = new URLSearchParams(wurl.search);
if(searchParams && searchParams.get('url')) {
if(this.isScalarWurl(wurl) && searchParams && searchParams.get('url')) {
curl = url.parse(searchParams.get('url'));
if(curl) {
curl.search = curl.query = "";
@ -33,6 +33,18 @@ export default class AppPermission extends React.Component {
return curlString;
}
isScalarWurl(wurl) {
if(wurl && wurl.hostname && (
wurl.hostname === 'scalar.vector.im' ||
wurl.hostname === 'scalar-staging.riot.im' ||
wurl.hostname === 'demo.riot.im' ||
wurl.hostname === 'localhost'
)) {
return true;
}
return false;
}
render() {
return (
<div className='mx_AppPermissionWarning'>