mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 11:42:15 -05:00
made storage path decision entirely based upon file extension
This commit is contained in:
parent
d7de311379
commit
6af97c724c
@ -13,6 +13,7 @@ import java.security.DigestOutputStream;
|
|||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ import android.webkit.MimeTypeMap;
|
|||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.entities.Downloadable;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
@ -78,7 +80,7 @@ public class FileBackend {
|
|||||||
if (path.startsWith("/")) {
|
if (path.startsWith("/")) {
|
||||||
return new DownloadableFile(path);
|
return new DownloadableFile(path);
|
||||||
} else {
|
} else {
|
||||||
if (message.getType() == Message.TYPE_FILE) {
|
if (Arrays.asList(Downloadable.VALID_IMAGE_EXTENSIONS).contains(extension)) {
|
||||||
return new DownloadableFile(getConversationsFileDirectory() + path);
|
return new DownloadableFile(getConversationsFileDirectory() + path);
|
||||||
} else {
|
} else {
|
||||||
return new DownloadableFile(getConversationsImageDirectory() + path);
|
return new DownloadableFile(getConversationsImageDirectory() + path);
|
||||||
|
Loading…
Reference in New Issue
Block a user