aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-11-25 22:37:58 +0100
committerChristian Schneppe <christian@pix-art.de>2017-11-25 22:37:58 +0100
commit97a6c82ff90650816b103616f3cbe1e585eb1721 (patch)
treee07f6ac007c3f5d50225ed35200e5d747ee79d7c /src/main/java/de/pixart/messenger
parent5834ed039e77303781929de3bd24c64c1e8aa3ef (diff)
don't return null for opus file extensions
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-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;
}