aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-01-31 22:43:40 +0100
committerChristian Schneppe <christian@pix-art.de>2018-01-31 22:43:40 +0100
commiteac6075113e04f819a7dabb831aacf5cd8dab94a (patch)
tree2b8037f1b49f7f5e11221436ac0eecd365586dda
parent7ad7d9aa3dabd51fcaeccf681d10391ec4d128d6 (diff)
fixed crash on receiving files
-rw-r--r--src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java3
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java2
2 files changed, 2 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
index 9985cf929..d2e6135a0 100644
--- a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
+++ b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
@@ -94,8 +94,7 @@ public class HttpDownloadConnection implements Transferable {
} else {
extension = lastPart;
}
- String filename = fileDateFormat.format(new Date(message.getTimeSent())) + "_" + message.getUuid().substring(0, 4);
- message.setRelativeFilePath(filename + (extension != null ? ("." + extension) : ""));
+ message.setRelativeFilePath(fileDateFormat.format(new Date(message.getTimeSent())) + "_" + message.getUuid().substring(0, 4) + (extension != null ? ("." + extension) : ""));
this.file = mXmppConnectionService.getFileBackend().getFile(message, false);
final String reference = mUrl.getRef();
if (reference != null && AesGcmURLStreamHandler.IV_KEY.matcher(reference).matches()) {
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 9c904ccd7..044cc0188 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -147,7 +147,7 @@ public class FileBackend {
|| message.getEncryption() == Message.ENCRYPTION_DECRYPTED);
String path = message.getRelativeFilePath();
if (path == null) {
- path = message.getUuid();
+ path = fileDateFormat.format(new Date(message.getTimeSent())) + "_" + message.getUuid().substring(0, 4);
}
final DownloadableFile file = getFileForPath(path, message.getMimeType());
if (encrypted) {