mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 13:47:04 +00:00
Decode Sophos Email Appliance proxy links
This commit is contained in:
parent
86ae66c88a
commit
c71664fcda
1 changed files with 19 additions and 0 deletions
|
@ -41,6 +41,7 @@ import android.text.TextWatcher;
|
|||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Base64;
|
||||
import android.util.Pair;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -65,6 +66,8 @@ import androidx.preference.PreferenceManager;
|
|||
|
||||
import java.net.IDN;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -569,6 +572,22 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
p = u.indexOf("/");
|
||||
}
|
||||
|
||||
changed = (result != null);
|
||||
url = (result == null ? uri : result);
|
||||
} else if (uri.getQueryParameterNames().size() == 1) {
|
||||
// Sophos Email Appliance
|
||||
Uri result = null;
|
||||
String key = uri.getQueryParameterNames().iterator().next();
|
||||
if (TextUtils.isEmpty(uri.getQueryParameter(key)))
|
||||
try {
|
||||
String data = new String(Base64.decode(key, Base64.DEFAULT));
|
||||
int u = data.indexOf("&&url=");
|
||||
if (u > 0)
|
||||
result = Uri.parse(URLDecoder.decode(data.substring(u + 6), StandardCharsets.UTF_8.name()));
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
changed = (result != null);
|
||||
url = (result == null ? uri : result);
|
||||
} else
|
||||
|
|
Loading…
Reference in a new issue