From 47ab2d14e1007acc5ea9ac0c1c2f4f5dee6e464b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 23 Jan 2019 22:04:15 -0500 Subject: [PATCH] [mailstream] Fix missing method App->get_curl_content_type() --- mailstream/mailstream.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index b00c72ed..4f86e704 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -154,17 +154,19 @@ function mailstream_do_images($a, &$item, &$attachments) { return; } $attachments = []; - $baseurl = $a->getBaseURL(); preg_match_all("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", $item["body"], $matches1); preg_match_all("/\[img\](.*?)\[\/img\]/ism", $item["body"], $matches2); foreach (array_merge($matches1[3], $matches2[1]) as $url) { - $redirects; + $redirects = 0; $cookiejar = tempnam(get_temppath(), 'cookiejar-mailstream-'); + $curlResult = Network::fetchUrlFull($url, true, $redirects, 0, null, $cookiejar); $attachments[$url] = [ - 'data' => Network::fetchUrl($url, true, $redirects, 0, null, $cookiejar), + 'data' => $curlResult->getBody(), 'guid' => hash("crc32", $url), 'filename' => basename($url), - 'type' => $a->get_curl_content_type()]; + 'type' => $curlResult->getContentType() + ]; + if (strlen($attachments[$url]['data'])) { $item['body'] = str_replace($url, 'cid:' . $attachments[$url]['guid'], $item['body']); continue; -- 2.39.5