https://reisub.nsupdate.info/git
/
friendica-addons.git
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d8d7178
)
Mailstream: remove URL parameters when extracting image filenames
author
Matthew Exon
<git.mexon@spamgourmet.com>
Sat, 28 Sep 2019 07:57:46 +0000
(09:57 +0200)
committer
Matthew Exon
<git.mexon@spamgourmet.com>
Sat, 28 Sep 2019 08:16:45 +0000
(10:16 +0200)
mailstream/mailstream.php
patch
|
blob
|
history
diff --git
a/mailstream/mailstream.php
b/mailstream/mailstream.php
index
e4abc59
..
bdd02a4
100644
(file)
--- a/
mailstream/mailstream.php
+++ b/
mailstream/mailstream.php
@@
-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) {
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),
$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()
];
'type' => $curlResult->getContentType()
];