Skip to content
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

Force parse text file attachment as file when Content-Disposition: attachment header #44

Closed
speller opened this issue Apr 15, 2016 · 4 comments

Comments

@speller
Copy link

speller commented Apr 15, 2016

Please add the ability to parse the text file attachment as file when the Content-Disposition: attachment header exists for the part. I have a mail with following part configuartion:

Content-Type: text/html; name="=?UTF-8?B?Y2hlY2tfcHJpbnQuZG8uaHRtbA==?="
Content-Disposition: attachment
Content-Transfer-Encoding: base64

The createPartParserForHeaders method tries to parse this attachment as text part of the mail, so it tries to convert its encoding to utf-8 and fails, because it tries to interpret the part as 'us-ascii'. This is the attachment so it has no the encoding headers (actual file encoding can be any multibyte enoding to cause the mail parsing failure). If I set the ezcMailPartParser::$parseTextAttachmentsAsFiles to True the entire mail is parsed successfully, but it consists from attachments only, without any body text.

Suggested fix at part_parser.php:170:

if (ezcMailPartParser::$parseTextAttachmentsAsFiles === true || isset($headers['Content-Disposition']) && $headers['Content-Disposition'] === 'attachment' )
@speller speller changed the title Force parce text file attachment as file when Content-Disposition: attachment header Force parse text file attachment as file when Content-Disposition: attachment header Apr 15, 2016
@speller
Copy link
Author

speller commented Apr 28, 2016

Corrected fix suggestion:

            case 'text':
                if (
                    ezcMailPartParser::$parseTextAttachmentsAsFiles === true ||
                    isset($headers['Content-Disposition']) && explode(';', $headers['Content-Disposition'])[0] === 'attachment'
                ) {
                    $bodyParser = new ezcMailFileParser( $mainType, $subType, $headers );
                }
                else
                {
                    $bodyParser = new ezcMailTextParser( $subType, $headers );
                }
                break;

@speller
Copy link
Author

speller commented Mar 20, 2018

Any news on this issue?

@derickr
Copy link
Member

derickr commented Jan 8, 2020

Is this still a live issue for you?

@derickr
Copy link
Member

derickr commented Jun 2, 2021

Closing this, as the requested feedback wasn't provided.

@derickr derickr closed this as completed Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@derickr @speller and others