Improve IdentityDatabase e164 check.

This commit is contained in:
Greyson Parrelli 2021-09-03 09:15:08 -04:00
parent 8c9eb880cf
commit 8e020c05f6

View file

@ -108,7 +108,7 @@ public class IdentityDatabase extends Database {
firstUse,
timestamp,
nonblockingApproval);
} else if (addressName.charAt(0) != '+') {
} else if (!fastIsE164(addressName)) {
if (DatabaseFactory.getRecipientDatabase(context).containsPhoneOrUuid(addressName)) {
Recipient recipient = Recipient.external(context, addressName);
@ -269,4 +269,8 @@ public class IdentityDatabase extends Database {
EventBus.getDefault().post(new IdentityRecord(recipientId, identityKey, verifiedStatus, firstUse, timestamp, nonBlockingApproval));
}
private boolean fastIsE164(@NonNull String value) {
return value.charAt(0) == '+' || value.length() <= 15;
}
}