From 3eef5c84c2e3777f78d144474bdaffa9953346a6 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 13 May 2014 09:09:16 -0500 Subject: [PATCH] thread: Detect inline and separate attachments If an email contains both inline and separate attachments, the previous logic would detect all the attachments as inline. Separate attachments have the `cid` set to `false`. This will pass the `isset` test, which would cause the logic to search through the body for a string of `cid:`, which would very likely be found if there was another inline image somewhere in the body of the email. --- include/class.thread.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/class.thread.php b/include/class.thread.php index 8d468d959..4b369d404 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -1055,7 +1055,8 @@ Class ThreadEntry { //Emailed or API attachments if (isset($vars['attachments']) && $vars['attachments']) { foreach ($vars['attachments'] as &$a) - if (isset($a['cid']) && strpos($body, 'cid:'.$a['cid']) !== false) + if (isset($a['cid']) && $a['cid'] + && strpos($body, 'cid:'.$a['cid']) !== false) $a['inline'] = true; unset($a); -- GitLab