1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 12:44:42 +00:00

Fixed query args Outlook safelinks

This commit is contained in:
M66B 2020-04-09 20:09:00 +02:00
parent 54d58812fe
commit 88a815334f

View file

@ -5217,24 +5217,26 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
else {
boolean changed = false;
Uri url;
Uri.Builder builder;
if (uri.getHost() != null &&
uri.getHost().endsWith("safelinks.protection.outlook.com") &&
!TextUtils.isEmpty(uri.getQueryParameter("url"))) {
changed = true;
builder = Uri.parse(uri.getQueryParameter("url")).buildUpon();
}
else
builder = uri.buildUpon();
url = Uri.parse(uri.getQueryParameter("url"));
} else
url = uri;
builder = url.buildUpon();
builder.clearQuery();
for (String key : uri.getQueryParameterNames())
for (String key : url.getQueryParameterNames())
// https://en.wikipedia.org/wiki/UTM_parameters
if (key.toLowerCase(Locale.ROOT).startsWith("utm_") ||
PARANOID_QUERY.contains(key.toLowerCase(Locale.ROOT)))
changed = true;
else if (!TextUtils.isEmpty(key))
for (String value : uri.getQueryParameters(key)) {
for (String value : url.getQueryParameters(key)) {
Log.i("Query " + key + "=" + value);
builder.appendQueryParameter(key, value);
}