diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 16 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 044cc0188..9bf826fe1 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -47,6 +47,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.List; import java.util.Locale; @@ -75,6 +76,10 @@ public class FileBackend { private XmppConnectionService mXmppConnectionService; + private static final List<String> BLACKLISTED_PATH_ELEMENTS = Arrays.asList( + "org.mozilla.firefox" + ); + public FileBackend(XmppConnectionService service) { this.mXmppConnectionService = service; } @@ -265,7 +270,7 @@ public class FileBackend { public boolean useImageAsIs(Uri uri) { String path = getOriginalPath(uri); - if (path == null) { + if (path == null || isPathBlacklisted(path)) { return false; } File file = new File(path); @@ -300,6 +305,15 @@ public class FileBackend { return false; } + public static boolean isPathBlacklisted(String path) { + for (String element : BLACKLISTED_PATH_ELEMENTS) { + if (path.contains(element)) { + return true; + } + } + return false; + } + public String getOriginalPath(Uri uri) { return FileUtils.getPath(mXmppConnectionService, uri); } diff --git a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java index 4ad16838c..038cdb2c9 100644 --- a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java +++ b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java @@ -57,7 +57,7 @@ public class AttachFileToConversationRunnable implements Runnable, MediaTranscod private void processAsFile() { final String path = mXmppConnectionService.getFileBackend().getOriginalPath(uri); - if (path != null) { + if (path != null && !FileBackend.isPathBlacklisted(path)) { message.setRelativeFilePath(path); mXmppConnectionService.getFileBackend().updateFileParams(message); if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) { |