aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorlookshe <github@lookshe.org>2015-08-21 19:26:47 +0200
committerlookshe <github@lookshe.org>2015-08-21 19:26:47 +0200
commitb4006541f3c11fa9bd88eae0c74a2e2b08e18685 (patch)
tree6dc9bc2765e83b14933fa66ed288a39b7c6fe9c7 /src/main/java/eu
parentb936af529ff541711500189a1b303ff43757892c (diff)
fixes FS#44 - IOException if content-length is not present
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
index 62fe4191..45f1e965 100644
--- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
+++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
@@ -150,7 +150,7 @@ public class HttpDownloadConnection implements Transferable {
return;
}
file.setExpectedSize(size);
- if (size <= mHttpConnectionManager.getAutoAcceptFileSize()) {
+ if (size != -1 && size <= mHttpConnectionManager.getAutoAcceptFileSize()) {
HttpDownloadConnection.this.acceptedAutomatically = true;
new Thread(new FileDownloader(interactive)).start();
} else {
@@ -171,12 +171,12 @@ public class HttpDownloadConnection implements Transferable {
connection.connect();
String contentLength = connection.getHeaderField("Content-Length");
if (contentLength == null) {
- throw new IOException();
+ return -1;
}
try {
return Long.parseLong(contentLength, 10);
} catch (NumberFormatException e) {
- throw new IOException();
+ return -1;
}
}