diff --git a/MsgReaderCore/Mime/Message.cs b/MsgReaderCore/Mime/Message.cs index 024cecd5..15f96faf 100644 --- a/MsgReaderCore/Mime/Message.cs +++ b/MsgReaderCore/Mime/Message.cs @@ -452,10 +452,9 @@ private MailMessage ToMailMessage() }; attachment.Name = string.IsNullOrEmpty(attachment.Name) ? attachmentMessagePart.FileName : attachment.Name; - if (attachment.ContentDisposition != null) - attachment.ContentDisposition.FileName = string.IsNullOrEmpty(attachment.ContentDisposition.FileName) - ? attachmentMessagePart.FileName - : attachment.ContentDisposition.FileName; + attachment.ContentDisposition.FileName = string.IsNullOrEmpty(attachment.ContentDisposition.FileName) + ? attachmentMessagePart.FileName + : attachment.ContentDisposition.FileName; message.Attachments.Add(attachment); } @@ -513,13 +512,13 @@ public void Save(Stream messageStream) if (_changed) { - messageStream.Write(RawMessage, 0, RawMessage.Length); - Logger.WriteToLog("Raw EML message saved"); + ToMailMessage().WriteTo(messageStream); + Logger.WriteToLog("EML message saved as new message"); } else { - ToMailMessage().WriteTo(messageStream); - Logger.WriteToLog("EML message saved as new message"); + messageStream.Write(RawMessage, 0, RawMessage.Length); + Logger.WriteToLog("Raw EML message saved"); } } #endregion