aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java3
-rw-r--r--src/main/java/de/pixart/messenger/utils/MimeUtils.java3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index ce8219f6e..3a53d31b9 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -341,6 +341,9 @@ public class FileBackend {
if (extension == null) {
extension = getExtensionFromUri(uri);
}
+ if (extension == null) {
+ extension = MimeUtils.guessExtensionFromMimeType(mime);
+ }
String filename = fileDateFormat.format(new Date(message.getTimeSent())) + "_" + message.getUuid().substring(0, 4);
message.setRelativeFilePath(filename + "." + extension);
copyFileToPrivateStorage(mXmppConnectionService.getFileBackend().getFile(message), uri);
diff --git a/src/main/java/de/pixart/messenger/utils/MimeUtils.java b/src/main/java/de/pixart/messenger/utils/MimeUtils.java
index d2ce21b72..bfcf71c6e 100644
--- a/src/main/java/de/pixart/messenger/utils/MimeUtils.java
+++ b/src/main/java/de/pixart/messenger/utils/MimeUtils.java
@@ -509,6 +509,9 @@ public final class MimeUtils {
String mimeType;
try {
mimeType = context.getContentResolver().getType(uri);
+ if (mimeType != null && mimeType.equals("application/octet-stream")) {
+ mimeType = null;
+ }
} catch (Throwable throwable) {
mimeType = null;
}