From 8121c8bd41ecf6f0846c423d8b1684b797c23667 Mon Sep 17 00:00:00 2001 From: yate Date: Wed, 4 Dec 2019 21:21:30 -0500 Subject: [PATCH] Remove blank MMS config overrides. Some SIM cards include blank values for `uaProfUrl` and `userAgent`. Passing in these blank values along with the overrides causes a 412 precondition error when downloading MMS from ATT&T. If these values happen to be blank, then they should be removed completely from the overrides, allowing the request to use the default `uaProfUrl` and `userAgent` for the system. Fixes #9173 --- .../securesms/mms/IncomingLollipopMmsConnection.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/org/thoughtcrime/securesms/mms/IncomingLollipopMmsConnection.java b/src/org/thoughtcrime/securesms/mms/IncomingLollipopMmsConnection.java index 1874e845db..2e873e988f 100644 --- a/src/org/thoughtcrime/securesms/mms/IncomingLollipopMmsConnection.java +++ b/src/org/thoughtcrime/securesms/mms/IncomingLollipopMmsConnection.java @@ -26,6 +26,8 @@ import androidx.annotation.Nullable; import android.os.Bundle; import android.telephony.SmsManager; +import android.text.TextUtils; + import org.thoughtcrime.securesms.logging.Log; import com.google.android.mms.InvalidHeaderValueException; @@ -99,6 +101,14 @@ public class IncomingLollipopMmsConnection extends LollipopMmsConnection impleme } } + if (TextUtils.isEmpty(configOverrides.getString(SmsManager.MMS_CONFIG_USER_AGENT))) { + configOverrides.remove(SmsManager.MMS_CONFIG_USER_AGENT); + } + + if (TextUtils.isEmpty(configOverrides.getString(SmsManager.MMS_CONFIG_UA_PROF_URL))) { + configOverrides.remove(SmsManager.MMS_CONFIG_UA_PROF_URL); + } + smsManager.downloadMultimediaMessage(getContext(), contentLocation, pointer.getUri(),