always copy firefoxe’s shared files
This commit is contained in:
parent
34425f2bd3
commit
4467368c8c
2 changed files with 16 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Reference in a new issue