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
This commit is contained in:
yate 2019-12-04 21:21:30 -05:00 committed by Greyson Parrelli
parent 6ca8218d55
commit 8121c8bd41

View File

@ -26,6 +26,8 @@ import androidx.annotation.Nullable;
import android.os.Bundle; import android.os.Bundle;
import android.telephony.SmsManager; import android.telephony.SmsManager;
import android.text.TextUtils;
import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.logging.Log;
import com.google.android.mms.InvalidHeaderValueException; 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(), smsManager.downloadMultimediaMessage(getContext(),
contentLocation, contentLocation,
pointer.getUri(), pointer.getUri(),