aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-02-15 19:12:57 +0100
committerChristian Schneppe <christian@pix-art.de>2018-02-15 19:12:57 +0100
commit4467368c8c9f08da589b2b8acdeea96b49048011 (patch)
treea8ea6cc05faaeae9605dbeb541ec9baf0df74253 /src
parent34425f2bd30e73027329dd51d32822382d889acd (diff)
always copy firefoxe’s shared files
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java16
-rw-r--r--src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java2
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) {