Commit c2a52593 authored by Seamus Lee's avatar Seamus Lee Committed by GitHub

Merge pull request #14207 from seamuslee001/dev_core_940

(#940) Fix regression involving Email Processor and ".unknown" attachments
parents 248ae427 30b0c4fe
......@@ -23,3 +23,20 @@ index 3acadc3..06f1e71 100644
/**
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @version //autogentag//
diff --git a/src/parser/interfaces/part_parser.php b/src/parser/interfaces/part_parser.php
index a81378b..6c59e5a 100644
--- a/src/parser/interfaces/part_parser.php
+++ b/src/parser/interfaces/part_parser.php
@@ -168,7 +168,11 @@ abstract class ezcMailPartParser
break;
case 'text':
- if ( ezcMailPartParser::$parseTextAttachmentsAsFiles === true )
+ // dev/core#940 Ensure that emails are not processed as .unknown attachments by checking
+ // for Filename or name in the content-disposition and content-type headers.
+ if ( (ezcMailPartParser::$parseTextAttachmentsAsFiles === true) &&
+ (preg_match('/\s*filename="?([^;"]*);?/i', $headers['Content-Disposition']) ||
+ preg_match( '/\s*name="?([^;"]*);?/i' , $headers['Content-Type']) ) )
{
$bodyParser = new ezcMailFileParser( $mainType, $subType, $headers );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment