@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+5 -3
+2 -2
externals/mimemailparser/MimeMailParser.class.php
··· 308 308 * @param $part Array 309 309 */ 310 310 private function getPartHeaders($part) { 311 - if (isset($part['headers'])) { 311 + if (isset($part['headers']) && $part['headers']) { 312 312 return $part['headers']; 313 313 } 314 - return false; 314 + throw new Exception('MimeMailParser::getHeaders() could not parse any email headers.'); 315 315 } 316 316 317 317 /**
+3 -1
scripts/mail/mail_handler.php
··· 55 55 } 56 56 57 57 $headers = $parser->getHeaders(); 58 - $headers['subject'] = phutil_decode_mime_header($headers['subject']); 58 + if (array_key_exists('subject', $headers)) { 59 + $headers['subject'] = phutil_decode_mime_header($headers['subject']); 60 + } 59 61 $headers['from'] = phutil_decode_mime_header($headers['from']); 60 62 61 63 if ($args->getArg('process-duplicates')) {