aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main/java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java16
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;
}
}