made storage path decision entirely based upon file extension

This commit is contained in:
Daniel Gultsch 2015-06-30 14:04:39 +02:00
parent d7de311379
commit 6af97c724c

View file

@ -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,7 +80,7 @@ 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);