Mailstream: remove URL parameters when extracting image filenames

pull/894/head
Matthew Exon 2019-09-28 09:57:46 +02:00
parent d8d717800c
commit 1f1f63c239
1 changed files with 2 additions and 1 deletions

View File

@ -157,12 +157,13 @@ function mailstream_do_images($a, &$item, &$attachments) {
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) {
$components = parse_url($url);
$cookiejar = tempnam(get_temppath(), 'cookiejar-mailstream-');
$curlResult = Network::fetchUrlFull($url, true, 0, '', $cookiejar);
$attachments[$url] = [
'data' => $curlResult->getBody(),
'guid' => hash("crc32", $url),
'filename' => basename($url),
'filename' => basename($components['path']),
'type' => $curlResult->getContentType()
];