-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content-Disposition is not parsing out the filename parameter #159
Comments
The problem is that the sending client did not properly quote the value. Spaces are not allowed. |
Looks like MimeKit already has a workaround for this. I've added a unit test and it passes. |
What is the workaround? I could not find anything in the ContentDisposition or the MimePart, so I when back to the MimePart Headers and Parsed the ContentDisposition header myself. |
You don't need to do anything. It just parses it already. Here's the unit test I added to verify it: |
n/m, it's failing for you because it has a newline in the middle of the value (which, again, is illegal...). I've "fixed" it, but now your filename value will have a newline in it. You really need to complain LOUDLY to the authors of the software that is constructing that message to have them fix their bugs. |
I would love to complain LOUDLY to a lot of vendors that only get part of it right. You are right that because the header is so long it is getting wrapped, but not properly. I do not know the source email system the other headers in the email do not give any indication, the receiving system was Exchange, but there is also a library used to convert from MSG to EML, and that might have introduced the error. The good thing is that we are migrating away from that library to a much better performing library "MimeKit" we just have to make sure our bases are covered for the few hundred million email that we deal with, and the exceptions like this. I thought it was interesting when looking at the dump because the headers for the MimePart have a nice cleaned up header, but did not have the FileName set. I used the following, not sure it is the quickest way, but it should only get hit once every 100,000 emails.
Thank you again for a great library and support. |
If you use the latest MimeKit from git master, you won't need to re-parse it anymore. Filtering out invalid characters is still a good idea to do, though. |
I will have to try that in my other project this one is currently configured for the NuGet release. |
What a royal pain in the ass it was to work around this brokenness :-\ |
But you did. Because you're awesome. ;-)
|
I have an email with an attachment that has the following headers, and the Content-Disposition is not reporting the filename parameter:
The MimePart does have the header:
Let me know if you need any additional information.
The text was updated successfully, but these errors were encountered: