-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PDF attachment is corrupt, is missing CR (0D) #9728
Comments
Try |
That didn't change anything, unfortunately. |
We'll need a sample message. Indeed the problem might be in how we decode quoted-printable. |
Can I send it to you privately somehow? It's a company document, I wouldn't want to post it here. |
It appears that the replacement regex might be the issue, at least that's the case with the e-mail I have:
I can do either of these: $chunk = preg_replace('/[\t\0\x0B]+\n/', "\n", $chunk); $chunk = preg_replace('/[\t\r\0\x0B]+\n/', "\r\n", $chunk); Not using |
All right. Using quoted-printable for pdf files is unusual, but maybe not necessarily invalid. Therefore we should fix it, either by removing that replacement, or doing this only for text/* parts. |
It sure is unusual. I tried to replicate it using the oldest client I had at hand (WinXP's Outlook Express), but even that one used base64 to encode the attachment. I also did What most quoted-printable pdfs have in common is that they were generated by EQEUS XFRX (Visual FoxPro report library used by some old ERPs) and embedded as attachment in a new email (probably through MAPI). Also, not all pdfs are visibly corrupt when parsed by RC, but that's a hit and miss depending on how much CRLF gets discarded. |
I looked back into the code changes. Back in the day it was just |
Interesting. For the e-mail in question, as far as the attachment is concerned, |
Prerequisites
Describe the issue
Note: I did find this seemingly similar yet old discussion: https://www.roundcubeforum.net/index.php?topic=8742.0
The problem I'm facing with a particular incoming e-mail has to do with Roundcube producing a corrupt PDF attachment, wheather in the preview window or downloaded. The only difference between the proper PDF and the one outputted by Roundcube is that the latter is missing all carriage returns (0D), only has line feeds. What's also particularly striking about this particular e-mail is that the PDF is embedded in the EML with quoted-printable encoding instead of base64. Nevertheless, Thunderbird and SnappyMail don't seem to have an issue parsing the attachment correctly.
Example of the encoded attachment
I don't want to share the e-mail because the PDF in it has sensitive data, but I could share it privately if necessary.
What browser(s) are you seeing the problem on?
Firefox
What version of PHP are you using?
v8.1
What version of Roundcube are you using?
v1.6.9
JavaScript errors
No response
PHP errors
No response
The text was updated successfully, but these errors were encountered: