From 14557d3dc17cdae2894f66050325ae963136461e Mon Sep 17 00:00:00 2001 From: Alan Evans Date: Tue, 15 Oct 2019 13:46:57 -0400 Subject: [PATCH] Change default GZIP behavior on Base64.decode(String). Remove only reference to Base64.decode(byte[]). --- .../securesms/mms/TextTransport.java | 34 ------------------- .../thoughtcrime/securesms/util/Base64.java | 8 +++-- 2 files changed, 5 insertions(+), 37 deletions(-) delete mode 100644 src/org/thoughtcrime/securesms/mms/TextTransport.java diff --git a/src/org/thoughtcrime/securesms/mms/TextTransport.java b/src/org/thoughtcrime/securesms/mms/TextTransport.java deleted file mode 100644 index 47735ab37d..0000000000 --- a/src/org/thoughtcrime/securesms/mms/TextTransport.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (C) 2011 Whisper Systems - * Copyright (C) 2014 Open Whisper Systems - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.thoughtcrime.securesms.mms; - -import org.thoughtcrime.securesms.util.Base64; - -import java.io.IOException; - - -public class TextTransport { - - public byte[] getDecodedMessage(byte[] encodedMessageBytes) throws IOException { - return Base64.decode(encodedMessageBytes); - } - - public byte[] getEncodedMessage(byte[] messageWithMac) { - return Base64.encodeBytes(messageWithMac).getBytes(); - } -} diff --git a/src/org/thoughtcrime/securesms/util/Base64.java b/src/org/thoughtcrime/securesms/util/Base64.java index f393efd2f8..896d46c5a5 100644 --- a/src/org/thoughtcrime/securesms/util/Base64.java +++ b/src/org/thoughtcrime/securesms/util/Base64.java @@ -1232,8 +1232,8 @@ public class Base64 /** - * Decodes data from Base64 notation, automatically - * detecting gzip-compressed data and decompressing it. + * Signal modified: + * Decodes data from Base64 notation, it does not detect gzip-compressed data. * * @param s the string to decode * @return the decoded data @@ -1241,7 +1241,9 @@ public class Base64 * @since 1.4 */ public static byte[] decode( String s ) throws java.io.IOException { - return decode( s, NO_OPTIONS ); + // Signal: We never use gzip, avoid trying to unzip. + // return decode( s, NO_OPTIONS ); + return decode( s, DONT_GUNZIP ); }