aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/http
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-06-01 21:41:41 +0200
committerChristian Schneppe <christian@pix-art.de>2016-06-01 21:41:41 +0200
commitc69ad3f6d245910d3af38bb2545cc13e9c296069 (patch)
tree7fc068607cbc16304e1a2ad32bada6a5b16f14fc /src/main/java/eu/siacs/conversations/http
parent9fa0aae644627956e1c3c3d8d4800ed685a86419 (diff)
use datetime as filename
Diffstat (limited to 'src/main/java/eu/siacs/conversations/http')
-rw-r--r--src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
index 51bfd5666..c7d68de16 100644
--- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
+++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
@@ -10,6 +10,9 @@ import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
import java.util.concurrent.CancellationException;
import javax.net.ssl.HttpsURLConnection;
@@ -40,6 +43,8 @@ public class HttpDownloadConnection implements Transferable {
private boolean mUseTor = false;
private boolean canceled = false;
+ private final SimpleDateFormat fileDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.US);
+
public HttpDownloadConnection(HttpConnectionManager manager) {
this.mHttpConnectionManager = manager;
this.mXmppConnectionService = manager.getXmppConnectionService();
@@ -88,7 +93,8 @@ public class HttpDownloadConnection implements Transferable {
} else {
extension = lastPart;
}
- message.setRelativeFilePath(message.getUuid() + "." + extension);
+ String filename = fileDateFormat.format(new Date(message.getTimeSent()));
+ message.setRelativeFilePath(filename + "." + extension);
this.file = mXmppConnectionService.getFileBackend().getFile(message, false);
String reference = mUrl.getRef();
if (reference != null && reference.length() == 96) {