aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-06-30 14:04:39 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-06-30 14:04:39 +0200
commit6af97c724cdcc7d94070a99e9035d84373c5eb75 (patch)
treee71a95d1b53ed3a00430d6bfa02fa4e289d85cfa /src
parentd7de3113795738ada1488f673f6e7b651e166058 (diff)
made storage path decision entirely based upon file extension
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/FileBackend.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index 6d37bbd5..c20cfa0e 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -13,6 +13,7 @@ import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
+import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
@@ -32,6 +33,7 @@ import android.webkit.MimeTypeMap;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.entities.Downloadable;
import eu.siacs.conversations.entities.DownloadableFile;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.XmppConnectionService;
@@ -78,10 +80,10 @@ public class FileBackend {
if (path.startsWith("/")) {
return new DownloadableFile(path);
} else {
- if (message.getType() == Message.TYPE_FILE) {
+ if (Arrays.asList(Downloadable.VALID_IMAGE_EXTENSIONS).contains(extension)) {
return new DownloadableFile(getConversationsFileDirectory() + path);
} else {
- return new DownloadableFile(getConversationsImageDirectory()+path);
+ return new DownloadableFile(getConversationsImageDirectory() + path);
}
}
}