Don't attach zero-byte files to message: Closes #5587
This commit is contained in:
parent
886918e27d
commit
0b94ba0a75
2 changed files with 17 additions and 6 deletions
1
THANKS
1
THANKS
|
|
@ -2,6 +2,7 @@ The Geary team would like to thank the following contributors:
|
|||
|
||||
Robert Ancell <robert.ancell@canonical.com>
|
||||
Jürg Billeter <j@bitron.ch>
|
||||
Martijn Braam <pizzamartijn@gmail.com>
|
||||
Andrea Corbellini <corbellini.andrea@gmail.com>
|
||||
Sergey Shnatsel Davidoff <sergey@elementaryos.org>
|
||||
Joanmarie Diggs <jdiggs@igalia.com>
|
||||
|
|
|
|||
|
|
@ -566,14 +566,24 @@ public class ComposerWindow : Gtk.Window {
|
|||
}
|
||||
|
||||
private bool add_attachment(File attachment_file) {
|
||||
if (!attachment_file.query_exists()) {
|
||||
attachment_failed(_("\"%s\" does not exist").printf(attachment_file.get_path()));
|
||||
FileInfo attachment_file_info;
|
||||
try {
|
||||
attachment_file_info = attachment_file.query_info("standard::size,standard::type",
|
||||
FileQueryInfoFlags.NONE);
|
||||
} catch(Error e) {
|
||||
attachment_failed(_("\"%s\" could not be found.").printf(attachment_file.get_path()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (attachment_file.query_file_type(FileQueryInfoFlags.NONE) == FileType.DIRECTORY) {
|
||||
attachment_failed(_("\"%s\" is a folder").printf(attachment_file.get_path()));
|
||||
if (attachment_file_info.get_file_type() == FileType.DIRECTORY) {
|
||||
attachment_failed(_("\"%s\" is a folder.").printf(attachment_file.get_path()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (attachment_file_info.get_size() == 0){
|
||||
attachment_failed(_("\"%s\" is an empty file.").printf(attachment_file.get_path()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -586,13 +596,13 @@ public class ComposerWindow : Gtk.Window {
|
|||
debug("File '%s' could not be opened for reading. Error: %s", attachment_file.get_path(),
|
||||
e.message);
|
||||
|
||||
attachment_failed(_("\"%s\" could not be opened for reading").printf(attachment_file.get_path()));
|
||||
attachment_failed(_("\"%s\" could not be opened for reading.").printf(attachment_file.get_path()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!attachment_files.add(attachment_file)) {
|
||||
attachment_failed(_("\"%s\" already attached for delivery").printf(attachment_file.get_path()));
|
||||
attachment_failed(_("\"%s\" already attached for delivery.").printf(attachment_file.get_path()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue