From bde838d35a59d7e3791ecf6fc7fe5b00ccd7b2f1 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 10 Dec 2015 18:49:58 -0800 Subject: [PATCH] Let's take this SMS number cleaning thing to its logical extreme Fixes #4833 // FREEBIE --- src/org/thoughtcrime/securesms/jobs/SmsSendJob.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/jobs/SmsSendJob.java b/src/org/thoughtcrime/securesms/jobs/SmsSendJob.java index 0e8f3a7b19..9ba215934c 100644 --- a/src/org/thoughtcrime/securesms/jobs/SmsSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SmsSendJob.java @@ -95,7 +95,9 @@ public class SmsSendJob extends SendJob { // stripSeparator() to rigid? what will people try to send here? - see discussion on #3099 //recipient = PhoneNumberUtils.stripSeparators(recipient); // minimum required to fix the issue - brackets are no dialable chars... - recipient = recipient.replaceAll("[\\(\\)\\s]", ""); + if (!NumberUtil.isValidEmail(recipient)) { + recipient = recipient.replaceAll("[^0-9+]", ""); + } // NOTE 11/04/14 -- There's apparently a bug where for some unknown recipients // and messages, this will throw an NPE. We have no idea why, so we're just