mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 03:19:24 +01:00
Stop scanning at tld
This commit is contained in:
@@ -426,6 +426,8 @@ public class EmailProvider implements Parcelable {
|
||||
candidates.addAll(_fromDomain(context, target, email, discover));
|
||||
int dot = target.indexOf('.');
|
||||
target = target.substring(dot + 1);
|
||||
if (UriHelper.isTld(context, target))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,18 @@ public class UriHelper {
|
||||
return (host != null && _getSuffix(context, host) != null);
|
||||
}
|
||||
|
||||
static boolean isTld(Context context, String host) {
|
||||
ensureSuffixList(context);
|
||||
|
||||
synchronized (suffixList) {
|
||||
int d = host.indexOf('.');
|
||||
String w = (d < 0 ? null : '*' + host.substring(d));
|
||||
return (!suffixList.contains('!' + host) &&
|
||||
!suffixList.contains(w) &&
|
||||
suffixList.contains(host));
|
||||
}
|
||||
}
|
||||
|
||||
private static String _getSuffix(Context context, @NonNull String host) {
|
||||
ensureSuffixList(context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user