aboutsummaryrefslogtreecommitdiff
path: root/plugins/http-files/src/file_provider.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-10-29 15:15:28 +0100
committerfiaxh <git@mx.ax.lt>2017-10-31 15:41:45 +0100
commit0102abeec1d2055b19dccbb7edc7f06e527642b1 (patch)
tree4018e82224c19142c4a7a6eced67d9c2550b2dd8 /plugins/http-files/src/file_provider.vala
parentb9df78e4494879752e9e68dcc5d54e03fffe9467 (diff)
downloaddino-0102abeec1d2055b19dccbb7edc7f06e527642b1.tar.gz
dino-0102abeec1d2055b19dccbb7edc7f06e527642b1.zip
Fix warnings
Diffstat (limited to 'plugins/http-files/src/file_provider.vala')
-rw-r--r--plugins/http-files/src/file_provider.vala8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/http-files/src/file_provider.vala b/plugins/http-files/src/file_provider.vala
index 9e677a92..53fe3bb0 100644
--- a/plugins/http-files/src/file_provider.vala
+++ b/plugins/http-files/src/file_provider.vala
@@ -48,8 +48,13 @@ public class FileProvider : Dino.FileProvider, Object {
if (name == "Content-Length") content_length = val;
});
if (/*content_type != null && content_type.has_prefix("image") &&*/ content_length != null && int.parse(content_length) < 5000000) {
- Soup.Request request = session.request (message.body);
FileTransfer file_transfer = new FileTransfer();
+ try {
+ Soup.Request request = session.request(message.body);
+ file_transfer.input_stream = request.send();
+ } catch (Error e) {
+ return;
+ }
file_transfer.account = conversation.account;
file_transfer.counterpart = message.counterpart;
file_transfer.ourpart = message.ourpart;
@@ -57,7 +62,6 @@ public class FileProvider : Dino.FileProvider, Object {
file_transfer.time = message.time;
file_transfer.local_time = message.local_time;
file_transfer.direction = message.direction;
- file_transfer.input_stream = request.send();
file_transfer.file_name = message.body.substring(message.body.last_index_of("/") + 1);
file_transfer.mime_type = content_type;
file_transfer.size = int.parse(content_length);