aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java12
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java10
2 files changed, 19 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index d670c98d9..e2d339841 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -261,6 +261,18 @@ public class FileBackend {
}
}
+ public boolean useFileAsIs(Uri uri) {
+ String path = getOriginalPath(uri);
+ if (path == null) {
+ return false;
+ }
+ if (path.contains(getConversationsDirectory("null"))) {
+ Log.d(Config.LOGTAG, "File " + path + " is in our directory, sending as is");
+ return true;
+ }
+ return false;
+ }
+
public String getOriginalPath(Uri uri) {
return FileUtils.getPath(mXmppConnectionService, uri);
}
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 8722bc3b7..752e65cfb 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -562,10 +562,14 @@ public class XmppConnectionService extends Service {
public void run() {
final String mimeType = MimeUtils.guessMimeTypeFromUri(XmppConnectionService.this, uri);
if (mimeType != null && mimeType.startsWith("video/") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
- try {
- processAsVideo();
- } catch (Throwable e) {
+ if (getFileBackend().useFileAsIs(uri)) {
processAsFile();
+ } else {
+ try {
+ processAsVideo();
+ } catch (Throwable e) {
+ processAsFile();
+ }
}
} else {
processAsFile();