diff --git a/app/src/main/java/eu/faircode/email/DnsBlockList.java b/app/src/main/java/eu/faircode/email/DnsBlockList.java index 588e9f29cd..7d3146e459 100644 --- a/app/src/main/java/eu/faircode/email/DnsBlockList.java +++ b/app/src/main/java/eu/faircode/email/DnsBlockList.java @@ -24,6 +24,7 @@ import android.content.SharedPreferences; import android.net.Uri; import android.text.TextUtils; +import androidx.core.net.MailTo; import androidx.preference.PreferenceManager; import java.net.Inet4Address; @@ -162,7 +163,17 @@ public class DnsBlockList { return (hasDomain ? false : null); } - static Boolean isJunk(Context context, String domain) { + static Boolean isJunk(Context context, Uri uri) { + String domain = null; + if ("mailto".equalsIgnoreCase(uri.getScheme())) { + MailTo email = MailTo.parse(uri.toString()); + domain = UriHelper.getEmailDomain(email.getTo()); + } else + domain = uri.getHost(); + + if (domain == null) + return null; + return isJunk(context, domain, false, BLOCK_LISTS); } diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java b/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java index f36e4ff624..1b2b12f5c9 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java @@ -408,13 +408,13 @@ public class FragmentDialogOpenLink extends FragmentDialogBase { if (check_links_dbl && tvSuspicious.getVisibility() != View.VISIBLE) { Bundle args = new Bundle(); - args.putString("host", host); + args.putParcelable("uri", uri); new SimpleTask() { @Override protected Boolean onExecute(Context context, Bundle args) throws Throwable { - String host = args.getString("host"); - return DnsBlockList.isJunk(context, host); + Uri uri = args.getParcelable("uri"); + return DnsBlockList.isJunk(context, uri); } @Override