extract extension manually if getFileExtensionFromUrl failed

This fixes issues with whitespace in filenames
This commit is contained in:
Vincent Breitmoser
2017-01-03 19:04:58 +01:00
parent a160c8fe7f
commit ac4bb3450f

View File

@@ -390,7 +390,10 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
} else {
// try to guess from file ending
String extension = MimeTypeMap.getFileExtensionFromUrl(originalFilename);
if (extension != null) {
if (TextUtils.isEmpty(extension) && originalFilename.contains(".")) {
extension = originalFilename.substring(originalFilename.lastIndexOf(".") +1);
}
if (!TextUtils.isEmpty(extension)) {
MimeTypeMap mime = MimeTypeMap.getSingleton();
mimeType = mime.getMimeTypeFromExtension(extension);
}