summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Caliste <dcaliste@free.fr>2018-09-05 09:28:01 +0200
committerPekka Vuorela <pvuorela@iki.fi>2018-09-07 15:35:36 +0000
commit7f44fcd6461b4a2c3c3538e8d6c454fa687d60bf (patch)
tree646d66027326ae32be3db54ad2679a99f984cf59
parent613d21eb3ca5bc851ea95e5405c2bcb185d12c4c (diff)
Don't fail loading a message with an empty part
For some valid email, the body is an empty file. For instance: $ ll $HOME/.qmf/mail/1487871842.4702.EL1S3-parts/ total 148 -rw-rw-r-- 1 nemo 147427 Feb 23 18:44 2.2 -rw-rw-r-- 1 nemo 188 Feb 23 18:44 2.1 -rw-rw-r-- 1 nemo 0 Feb 23 18:44 1 In that case, the part loader of the content manager plugin is returning false because after loading the body of part 1, it fails the test part.hasBody(), resulting in the message being not loaded because one part fails. This test makes sense to check that there was no obvious error while loading the file, but it is not properly handling the case when the file is empty. Anyhow the empty file was created or if it makes sense or not, the part loader should not fail in that case because the part exists on disk and is readable, but simply empty. Change-Id: Ide1b8b4260cfeb89c5d3bec70593f36052b04f1b Reviewed-by: Michael Nosov <Michael.Nosov@harman.com> Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
-rw-r--r--src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.cpp b/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.cpp
index e59d6d42..3119ca6e 100644
--- a/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.cpp
+++ b/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.cpp
@@ -402,7 +402,7 @@ struct PartLoader
// server-side data, the parameter seems reversed...
QMailMessageBody::EncodingStatus dataState(part.contentAvailable() ? QMailMessageBody::AlreadyEncoded : QMailMessageBody::RequiresEncoding);
part.setBody(QMailMessageBody::fromFile(partFilePath, part.contentType(), part.transferEncoding(), dataState));
- if (!part.hasBody())
+ if (!part.hasBody() && QFile(partFilePath).size())
return false;
}
}