Fix #38 - Remove tracking params from Original URLs before redirect

This commit is contained in:
Thomas 2020-09-06 18:54:38 +02:00
parent e9f68ba609
commit 800a1e4316
1 changed files with 3 additions and 2 deletions

View File

@ -80,6 +80,7 @@ public class TransformActivity extends Activity {
//Dealing with URLs //Dealing with URLs
if (Objects.requireNonNull(intent.getAction()).equals(Intent.ACTION_VIEW)) { if (Objects.requireNonNull(intent.getAction()).equals(Intent.ACTION_VIEW)) {
String url = Objects.requireNonNull(intent.getData()).toString(); String url = Objects.requireNonNull(intent.getData()).toString();
url = remove_tracking_param(url);
URL url_; URL url_;
String host = null; String host = null;
try { try {
@ -88,6 +89,7 @@ public class TransformActivity extends Activity {
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace();
} }
//Shortened URLs //Shortened URLs
if (Arrays.asList(shortener_domains).contains(host)) { if (Arrays.asList(shortener_domains).contains(host)) {
manageShortened(TransformActivity.this, url); manageShortened(TransformActivity.this, url);
@ -343,6 +345,7 @@ public class TransformActivity extends Activity {
forwardToBrowser(TransformActivity.this, sendIntent); forwardToBrowser(TransformActivity.this, sendIntent);
return; return;
} }
url = Utils.remove_tracking_param(url);
Uri url_r = Uri.parse(url); Uri url_r = Uri.parse(url);
String scheme = url_r.getScheme(); String scheme = url_r.getScheme();
if (scheme == null) { if (scheme == null) {
@ -490,8 +493,6 @@ public class TransformActivity extends Activity {
} }
} }
} }
} else {
newUrl = remove_tracking_param(url);
} }
if (newUrl != null) { if (newUrl != null) {
extraText = extraText.replaceAll(Pattern.quote(url), Matcher.quoteReplacement(newUrl)); extraText = extraText.replaceAll(Pattern.quote(url), Matcher.quoteReplacement(newUrl));