From ff4929fcce115c469ccf1a5688fdcd0f5474c4c7 Mon Sep 17 00:00:00 2001 From: zipperle Date: Fri, 3 Jul 2015 15:08:27 +0200 Subject: [PATCH] URL decode numbers in quick response. Fixes #3518 Closes #3522 --- .../securesms/service/QuickResponseService.java | 7 ++++++- .../org/thoughtcrime/securesms/util/Rfc5724UriTest.java | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/service/QuickResponseService.java b/src/org/thoughtcrime/securesms/service/QuickResponseService.java index aeda4dcbde..a98b6fe18c 100644 --- a/src/org/thoughtcrime/securesms/service/QuickResponseService.java +++ b/src/org/thoughtcrime/securesms/service/QuickResponseService.java @@ -19,6 +19,7 @@ import org.thoughtcrime.securesms.sms.OutgoingTextMessage; import org.thoughtcrime.securesms.util.Rfc5724Uri; import java.net.URISyntaxException; +import java.net.URLDecoder; public class QuickResponseService extends MasterSecretIntentService { @@ -44,7 +45,11 @@ public class QuickResponseService extends MasterSecretIntentService { try { Rfc5724Uri uri = new Rfc5724Uri(intent.getDataString()); String content = intent.getStringExtra(Intent.EXTRA_TEXT); - Recipients recipients = RecipientFactory.getRecipientsFromString(this, uri.getPath(), false); + String numbers = uri.getPath(); + if(numbers.contains("%")){ + numbers = URLDecoder.decode(numbers); + } + Recipients recipients = RecipientFactory.getRecipientsFromString(this, numbers, false); if (!TextUtils.isEmpty(content)) { if (recipients.isSingleRecipient()) { diff --git a/test/androidTest/java/org/thoughtcrime/securesms/util/Rfc5724UriTest.java b/test/androidTest/java/org/thoughtcrime/securesms/util/Rfc5724UriTest.java index 73452b4e92..095dcf3e19 100644 --- a/test/androidTest/java/org/thoughtcrime/securesms/util/Rfc5724UriTest.java +++ b/test/androidTest/java/org/thoughtcrime/securesms/util/Rfc5724UriTest.java @@ -65,6 +65,7 @@ public class Rfc5724UriTest extends TextSecureTestCase { public void testGetPath() throws Exception { final String[][] uriTestPairs = { {"sms:+15555555555", "+15555555555"}, + {"sms:%2B49555555555", "%2B555555555"}, {"smsto:+15555555555?", "+15555555555"}, {"mms:+15555555555?a=b", "+15555555555"}, {"mmsto:+15555555555?a=b&c=d", "+15555555555"},