mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-21 14:22:41 +01:00
Make incoming mail handling more robust / correct
Summary: * Properly handle when no mail headers at all can be parsed * Properly handle when mail headers can be parsed but no subject line can be found ``` EXCEPTION: (RuntimeException) Undefined index: subject ``` Closes T15769 Test Plan: See T15769 Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: 20after4, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15769 Differential Revision: https://we.phorge.it/D25565
This commit is contained in:
parent
c0bc453405
commit
644f179dd2
2 changed files with 5 additions and 3 deletions
|
@ -308,10 +308,10 @@ class MimeMailParser {
|
|||
* @param $part Array
|
||||
*/
|
||||
private function getPartHeaders($part) {
|
||||
if (isset($part['headers'])) {
|
||||
if (isset($part['headers']) && $part['headers']) {
|
||||
return $part['headers'];
|
||||
}
|
||||
return false;
|
||||
throw new Exception('MimeMailParser::getHeaders() could not parse any email headers.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,7 +55,9 @@ foreach (array('text', 'html') as $part) {
|
|||
}
|
||||
|
||||
$headers = $parser->getHeaders();
|
||||
$headers['subject'] = phutil_decode_mime_header($headers['subject']);
|
||||
if (array_key_exists('subject', $headers)) {
|
||||
$headers['subject'] = phutil_decode_mime_header($headers['subject']);
|
||||
}
|
||||
$headers['from'] = phutil_decode_mime_header($headers['from']);
|
||||
|
||||
if ($args->getArg('process-duplicates')) {
|
||||
|
|
Loading…
Reference in a new issue