URL decode numbers in quick response.

Fixes #3518
Closes #3522
This commit is contained in:
zipperle 2015-07-03 15:08:27 +02:00 committed by Moxie Marlinspike
parent 1a7ab6346f
commit ff4929fcce
2 changed files with 7 additions and 1 deletions

View File

@ -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()) {

View File

@ -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"},