mirror of https://github.com/M66B/FairEmail.git
Guess URL scheme
This commit is contained in:
parent
7c5ffd3508
commit
28b826a22c
|
@ -573,8 +573,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
if (link.length > 0) {
|
||||
String url = link[0].getURL();
|
||||
Uri uri = Uri.parse(url);
|
||||
if (uri.getScheme() == null)
|
||||
uri = Uri.parse("https://" + url);
|
||||
|
||||
int start = buffer.getSpanStart(link[0]);
|
||||
int end = buffer.getSpanEnd(link[0]);
|
||||
|
|
|
@ -44,6 +44,7 @@ import android.view.KeyEvent;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.webkit.URLUtil;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
|
@ -119,7 +120,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
final Uri uri = getArguments().getParcelable("uri");
|
||||
Uri _uri = getArguments().getParcelable("uri");
|
||||
String _title = getArguments().getString("title");
|
||||
if (_title != null)
|
||||
_title = _title.replace("\uFFFC", ""); // Object replacement character
|
||||
|
@ -135,6 +136,20 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
// Preload web view
|
||||
Helper.customTabsWarmup(context);
|
||||
|
||||
final Uri uri;
|
||||
if (_uri.getScheme() == null) {
|
||||
Uri g = Uri.parse(URLUtil.guessUrl(_uri.toString()));
|
||||
String scheme = g.getScheme();
|
||||
if (scheme != null) {
|
||||
if ("http".equals(scheme))
|
||||
scheme = "https";
|
||||
uri = Uri.parse(scheme + "://" + _uri.toString());
|
||||
}
|
||||
else
|
||||
uri = _uri;
|
||||
} else
|
||||
uri = _uri;
|
||||
|
||||
// Process link
|
||||
final Uri sanitized;
|
||||
if (uri.isOpaque())
|
||||
|
|
Loading…
Reference in New Issue