This project is read-only.

Attachment Corruption.

Topics: Issues
Jul 28, 2014 at 10:15 PM
Hi gang,

Stumbled across this great library a few days ago and have been playing with code that allows me to download email attachments to disk.

I've noticed that occasionally, some attachments appear corrupt when calling the Attachment.Save() method.

It appears that two extra '0x00' characters are added at the end of the file when saved to disk.


I've dug into the code and noticed that last character in the _content.ContentStream contains a 0x20 character after the "==" characters. This character, converted from base 64 is what's giving us the extra two null characters.

When I remove this extra space character in the watch window, then let it save to disk, the problem is resolved.

So, a relatively easy fix to make when using the newest .NET Framework version etc. I'm using the .NET 2.0 version - is someone able to redirect me to source-code for this version? How do you compile a .NET 2.0 Version?

Any information you can provide would be great. Thanks so much for such a great library!
Jul 29, 2014 at 2:00 AM
More info here...

The extra space gets tacked on by (MessageContent.c):

data = " UID 69)"
        else if ((index = data.IndexOf("UID")) != -1)
            data = CommandJunkUID.Replace(data, "");
after replace, data = "<space>)"
.. Next piece of code that runs: removes bracket, keeps space..
        else if (CommandEndRex.IsMatch(data))
            for (var i = _contentBuilder.Length - 1; i >= 0; i--)
                if (_contentBuilder[i] == ')')
                    _contentBuilder.Remove(i, _contentBuilder.Length - i);

Jul 29, 2014 at 11:56 AM
Hi Magnified,

the .Net 2.0 version is compiled using the code available in the repository. All you need to do is adding the LinqBridge Nuget package in order to be able to compile it.

I will make a fix based on your findings tonight.