From 141eb8a497d847069cf87ce0d204614596338352 Mon Sep 17 00:00:00 2001 From: svncommit <devs@roundcube.net> Date: Thu, 20 May 2010 23:24:25 -0400 Subject: [PATCH] Fix double-addition of e-mail domain to content ID in HTML images --- program/lib/Mail/mime.php | 6 ++++-- CHANGELOG | 1 + program/steps/mail/sendmail.inc | 15 ++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 125c980..7c7b665 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG RoundCube Webmail =========================== +- Fix double-addition of e-mail domain to content ID in HTML images - Read and send messages with format=flowed (#1484370), fixes word wrapping issues (#1486543) - Fix duplicated attachments when forwarding a message (#1486487) - Fix message/rfc822 attachments containing only attachments are not parsed properly (#1486743) diff --git a/program/lib/Mail/mime.php b/program/lib/Mail/mime.php index ca54a8a..9065d46 100644 --- a/program/lib/Mail/mime.php +++ b/program/lib/Mail/mime.php @@ -848,8 +848,10 @@ $domainID = "@localhost"; } foreach ($this->_html_images as $i => $img) { - $this->_html_images[$i]['cid'] - = $this->_html_images[$i]['cid'] . $domainID; + $cid = $this->_html_images[$i]['cid']; + if (!preg_match('#'.preg_quote($domainID).'$#', $cid)) { + $this->_html_images[$i]['cid'] = $cid . $domainID; + } } } diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 2576a66..dedab99 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -95,18 +95,14 @@ /** * go from this: - * <img src=".../tiny_mce/plugins/emotions/images/smiley-cool.gif" border="0" alt="Cool" title="Cool" /> + * <img src="http[s]://.../tiny_mce/plugins/emotions/images/smiley-cool.gif" border="0" alt="Cool" title="Cool" /> * * to this: * - * <IMG src="cid:smiley-cool.gif"/> + * <img src="/path/on/server/.../tiny_mce/plugins/emotions/images/smiley-cool.gif" border="0" alt="Cool" title="Cool" /> * ... - * ------part... - * Content-Type: image/gif - * Content-Transfer-Encoding: base64 - * Content-ID: <smiley-cool.gif> */ -function rcmail_attach_emoticons(&$mime_message) +function rcmail_fix_emoticon_paths(&$mime_message) { global $CONFIG; @@ -437,8 +433,9 @@ $plugin = $RCMAIL->plugins->exec_hook('outgoing_message_body', array('body' => $plainTextPart, 'type' => 'alternative', 'message' => $MAIL_MIME)); $MAIL_MIME->setTXTBody($plugin['body']); - // look for "emoticon" images from TinyMCE and copy into message as attachments - $message_body = rcmail_attach_emoticons($MAIL_MIME); + // look for "emoticon" images from TinyMCE and change their src paths to + // be file paths on the server instead of URL paths. + $message_body = rcmail_fix_emoticon_paths($MAIL_MIME); } else { if ($footer) -- Gitblit v1.9.1