diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-09-21 11:49:03 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-09-21 11:49:03 +0200 |
commit | d8f664bd179e76c2b9eb9fda4ffc3254a1ded067 (patch) | |
tree | 1188f0e827a4d03de730207b3ed7b025f71a3558 | |
parent | 4c1d48bd951cbc302bdb2821bdfd501405f3abe0 (diff) | |
download | open-keychain-d8f664bd179e76c2b9eb9fda4ffc3254a1ded067.tar.gz open-keychain-d8f664bd179e76c2b9eb9fda4ffc3254a1ded067.tar.bz2 open-keychain-d8f664bd179e76c2b9eb9fda4ffc3254a1ded067.zip |
mime: don't do mime parsing if the encrypted data has a filename
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java index 7ec57cb2d..7ec33874f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java @@ -28,6 +28,7 @@ import java.util.ArrayList; import android.content.Context; import android.net.Uri; import android.support.annotation.NonNull; +import android.text.TextUtils; import org.apache.james.mime4j.MimeException; import org.apache.james.mime4j.codec.DecodeMonitor; @@ -124,14 +125,17 @@ public class InputDataOperation extends BaseOperation<InputDataParcel> { currentInputUri = input.getInputUri(); } - // don't even attempt if we know the data isn't suitable for mime content + // don't even attempt if we know the data isn't suitable for mime content, or if we have a filename boolean skipMimeParsing = false; if (decryptResult != null && decryptResult.getDecryptionMetadata() != null) { - String contentType = decryptResult.getDecryptionMetadata().getMimeType(); - if (contentType != null - && !contentType.startsWith("multipart/") - && !contentType.startsWith("text/") - && !contentType.startsWith("application/")) { + OpenPgpMetadata metadata = decryptResult.getDecryptionMetadata(); + String fileName = metadata.getFilename(); + String contentType = metadata.getMimeType(); + if (!TextUtils.isEmpty(fileName) + || contentType != null + && !contentType.startsWith("multipart/") + && !contentType.startsWith("text/") + && !contentType.startsWith("application/")) { skipMimeParsing = true; } } |