mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Strip query parameters from content URLs
This commit is contained in:
parent
d69c9a36b3
commit
e1d9301eb4
@ -16,16 +16,23 @@ export default class AppPermission extends React.Component {
|
|||||||
getCurl() {
|
getCurl() {
|
||||||
const wurl = url.parse(this.props.url);
|
const wurl = url.parse(this.props.url);
|
||||||
let curl;
|
let curl;
|
||||||
|
let curlString;
|
||||||
|
|
||||||
const searchParams = new URLSearchParams(wurl.search);
|
const searchParams = new URLSearchParams(wurl.search);
|
||||||
|
|
||||||
|
// Return string representation of content URL without query parameters
|
||||||
if(searchParams && searchParams.get('url')) {
|
if(searchParams && searchParams.get('url')) {
|
||||||
curl = searchParams.get('url');
|
curl = url.parse(searchParams.get('url'));
|
||||||
|
if(curl) {
|
||||||
|
curl.search = curl.query = "";
|
||||||
|
curlString = curl.format();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!curl && wurl) {
|
if (!curl && wurl) {
|
||||||
wurl.search = wurl.query = "";
|
wurl.search = wurl.query = "";
|
||||||
curl = wurl.format();
|
curlString = wurl.format();
|
||||||
}
|
}
|
||||||
return curl;
|
return curlString;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Loading…
Reference in New Issue
Block a user