From: jangliss Date: Tue, 8 Feb 2005 15:13:31 +0000 (+0000) Subject: Fix for #855320 where Outlook Express was creating CID: based URLs, X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c8f5f60645a2e7b39efbbe06ad599e9145827338;p=squirrelmail.git Fix for #855320 where Outlook Express was creating CID: based URLs, but not assigning a content-id to the attachment. This is a bug in Outlook Express and is non-RFC compliant behaviour. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8822 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/ChangeLog b/ChangeLog index c49e4eae..0202e43a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -211,6 +211,9 @@ Version 1.5.1 -- CVS an already subscribed folder (#1115409). - Added blank.png for missing image support. - Use the proper attachment filenames in case of forwarding a message. + - Fix for #855320 where Outlook Express was creating CID: based URLs, + but not assigning a content-id to the attachment. This is a bug in + Outlook Express and is non-RFC compliant behaviour. Version 1.5.0 diff --git a/functions/mime.php b/functions/mime.php index ea49c4d8..93c95a04 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -866,6 +866,15 @@ function find_ent_id($id, $message) { // if (sq_check_save_extension($message->entities[$i])) { return $message->entities[$i]->entity_id; // } + } elseif (!empty($message->entities[$i]->header->parameters['name'])) { + /** + * This is part of a fix for Outlook Express 6.x generating + * cid URLs without creating content-id headers + * @@JA - 20050207 + */ + if (strcasecmp($message->entities[$i]->header->parameters['name'], $id) == 0) { + return $message->entities[$i]->entity_id; + } } } } @@ -1550,11 +1559,37 @@ function sq_cid2http($message, $id, $cidurl, $mailbox){ /* in case of non-save cid links $httpurl should be replaced by a sort of unsave link image */ $httpurl = ''; - if ($linkurl) { + + /** + * This is part of a fix for Outlook Express 6.x generating + * cid URLs without creating content-id headers. These images are + * not part of the multipart/related html mail. The html contains + * references to + * attached images with as goal to render them inline although + * the attachment disposition property is not inline. + **/ + + if (empty($linkurl)) { + if (preg_match('/{.*}\//', $cidurl)) { + $cidurl = preg_replace('/{.*}\//','', $cidurl); + if (!empty($cidurl)) { + $linkurl = find_ent_id($cidurl, $message); + } + } + } + + if (!empty($linkurl)) { $httpurl = $quotchar . SM_PATH . 'src/download.php?absolute_dl=true&' . - "passed_id=$id&mailbox=" . urlencode($mailbox) . - '&ent_id=' . $linkurl . $quotchar; + "passed_id=$id&mailbox=" . urlencode($mailbox) . + '&ent_id=' . $linkurl . $quotchar; + } else { + /** + * If we couldn't generate a proper img url, drop in a blank image + * instead of sending back empty, otherwise it causes unusual behaviour + */ + $httpurl = $quotechar . SM_PATH . 'images/blank.png'; } + return $httpurl; } @@ -2046,4 +2081,4 @@ function SendDownloadHeaders($type0, $type1, $filename, $force, $filesize=0) { } // end fn SendDownloadHeaders -?> \ No newline at end of file +?>