From e1d9301eb4d704a39dc9b970c803050973f48dc9 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Fri, 28 Jul 2017 10:01:58 +0100 Subject: [PATCH] Strip query parameters from content URLs --- src/components/views/elements/AppPermission.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/views/elements/AppPermission.js b/src/components/views/elements/AppPermission.js index 369ffeade7..b37ddd8c8e 100644 --- a/src/components/views/elements/AppPermission.js +++ b/src/components/views/elements/AppPermission.js @@ -16,16 +16,23 @@ export default class AppPermission extends React.Component { getCurl() { const wurl = url.parse(this.props.url); let curl; + let curlString; const searchParams = new URLSearchParams(wurl.search); + + // Return string representation of content URL without query parameters 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) { wurl.search = wurl.query = ""; - curl = wurl.format(); + curlString = wurl.format(); } - return curl; + return curlString; } render() {