mirror of https://github.com/M66B/FairEmail.git
Check message ID raw message file
This commit is contained in:
parent
af1aabf004
commit
6565f6dee1
|
@ -941,13 +941,17 @@ class Core {
|
|||
// Cross account move
|
||||
if (!file.exists())
|
||||
throw new IllegalArgumentException("raw message file not found");
|
||||
if (TextUtils.isEmpty(message.msgid))
|
||||
throw new IllegalArgumentException("Message-ID missing");
|
||||
|
||||
Log.i(folder.name + " reading " + file);
|
||||
try (InputStream is = new BufferedInputStream(new FileInputStream(file))) {
|
||||
imessage = new MimeMessage(isession, is);
|
||||
}
|
||||
|
||||
// Check message ID to check raw message file content
|
||||
MessageHelper helper = new MessageHelper(imessage, context);
|
||||
String msgid = helper.getMessageID();
|
||||
if (TextUtils.isEmpty(message.msgid) || !Objects.equals(message.msgid, msgid))
|
||||
throw new IllegalArgumentException("Inconsistent msgid=" + message.msgid + "/" + msgid);
|
||||
}
|
||||
|
||||
db.message().setMessageRaw(message.id, true);
|
||||
|
|
Loading…
Reference in New Issue