Page MenuHomePhabricator

D17781.id.diff
No OneTemporary

D17781.id.diff

diff --git a/scripts/mail/mail_handler.php b/scripts/mail/mail_handler.php
--- a/scripts/mail/mail_handler.php
+++ b/scripts/mail/mail_handler.php
@@ -37,14 +37,16 @@
$text_body = $parser->getMessageBody('text');
-$text_body_headers = $parser->getMessageBodyHeaders('text');
-$content_type = idx($text_body_headers, 'content-type');
-if (
- !phutil_is_utf8($text_body) &&
- (preg_match('/charset="(.*?)"/', $content_type, $matches) ||
- preg_match('/charset=(\S+)/', $content_type, $matches))
-) {
- $text_body = phutil_utf8_convert($text_body, 'UTF-8', $matches[1]);
+if ($text_body !== false) {
+ $text_body_headers = $parser->getMessageBodyHeaders('text');
+ $content_type = idx($text_body_headers, 'content-type');
+ if (
+ !phutil_is_utf8($text_body) &&
+ (preg_match('/charset="(.*?)"/', $content_type, $matches) ||
+ preg_match('/charset=(\S+)/', $content_type, $matches))
+ ) {
+ $text_body = phutil_utf8_convert($text_body, 'UTF-8', $matches[1]);
+ }
}
$headers = $parser->getHeaders();

File Metadata

Mime Type
text/plain
Expires
Mon, May 13, 6:42 AM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6275152
Default Alt Text
D17781.id.diff (1 KB)

Event Timeline