mirror of https://github.com/M66B/FairEmail.git
Stop scanning at tld
This commit is contained in:
parent
a8020d4f05
commit
f9418593ca
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue