diff options
author | fiaxh <git@lightrise.org> | 2019-08-21 19:31:46 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-08-21 22:37:52 +0200 |
commit | 0521afa3d828ea0dfc79e6c5c76697e2a3a270c0 (patch) | |
tree | b7d64f2b2e13d01c81621962816d90e8b8e279ca /plugins/http-files/src/file_provider.vala | |
parent | 3ad2891eb80d9381fed8547d6429904120af1f3e (diff) | |
download | dino-0521afa3d828ea0dfc79e6c5c76697e2a3a270c0.tar.gz dino-0521afa3d828ea0dfc79e6c5c76697e2a3a270c0.zip |
Fix specified size for encrypted file uploads
Diffstat (limited to 'plugins/http-files/src/file_provider.vala')
-rw-r--r-- | plugins/http-files/src/file_provider.vala | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/http-files/src/file_provider.vala b/plugins/http-files/src/file_provider.vala index 38687863..2ce8d96b 100644 --- a/plugins/http-files/src/file_provider.vala +++ b/plugins/http-files/src/file_provider.vala @@ -62,7 +62,7 @@ public class FileProvider : Dino.FileProvider, Object { receive_data.url = message.body; var file_meta = new HttpFileMeta(); - file_meta.file_name = Uri.unescape_string(message.body.substring(message.body.last_index_of("/") + 1)); + file_meta.file_name = extract_file_name_from_url(message.body); file_meta.message = message; file_incoming(additional_info, message.from, message.time, message.local_time, conversation, receive_data, file_meta); @@ -121,11 +121,7 @@ public class FileProvider : Dino.FileProvider, Object { file_meta.size = file_transfer.size; file_meta.mime_type = file_transfer.mime_type; - // Extract file name from URL - file_meta.file_name = Uri.unescape_string(message.body.substring(message.body.last_index_of("/") + 1)); - if (file_meta.file_name.contains("#")) { - file_meta.file_name = file_meta.file_name.substring(0, file_meta.file_name.last_index_of("#")); - } + file_meta.file_name = extract_file_name_from_url(message.body); file_meta.message = message; @@ -145,6 +141,14 @@ public class FileProvider : Dino.FileProvider, Object { return receive_data; } + private string extract_file_name_from_url(string url) { + string ret = Uri.unescape_string(url.substring(url.last_index_of("/") + 1)); + if (ret.contains("#")) { + ret = ret.substring(0, ret.last_index_of("#")); + } + return ret; + } + public int get_id() { return 0; } } |