Be more liberal with migration addresses.

Anything alpha is an address as-is.

// FREEBIE.
This commit is contained in:
Moxie Marlinspike 2017-08-01 14:46:38 -07:00
parent a67d0b18ff
commit 8a5c89244a

View File

@ -1286,6 +1286,8 @@ public class DatabaseFactory {
private final String localCountryCode;
private final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
private final Pattern ALPHA_PATTERN = Pattern.compile("[a-zA-Z]");
public NumberMigrator(String localNumber) {
try {
@ -1300,7 +1302,7 @@ public class DatabaseFactory {
public String migrate(@Nullable String number) {
if (number == null) return "Unknown";
if (number.startsWith("__textsecure_group__!")) return number;
if (android.util.Patterns.EMAIL_ADDRESS.matcher(number).matches()) return number;
if (ALPHA_PATTERN.matcher(number).matches()) return number;
String bareNumber = number.replaceAll("[^0-9+]", "");