diff options
author | thomascube <thomas@roundcube.net> | 2008-09-05 09:29:06 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-09-05 09:29:06 +0000 |
commit | c505e59a6d2cf45233c1e0de186b8d6fe9d804ba (patch) | |
tree | cb9632db4a2b06d181bafc6d478a26d33bfd276d /program/include | |
parent | c8a21d646ca96aaf00867b90b582a6572c591ee2 (diff) |
Respect Content-Location headers in multipart/related messages (#1484946)
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcube_imap.php | 15 | ||||
-rw-r--r-- | program/include/rcube_message.php | 10 |
2 files changed, 17 insertions, 8 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 51e6b7dd5..439c55663 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -1149,16 +1149,17 @@ class rcube_imap if (empty($struct->disposition)) $struct->disposition = 'inline'; } + + // fetch message headers if message/rfc822 or named part (could contain Content-Location header) + if ($struct->ctype_primary == 'message' || ($struct->ctype_parameters['name'] && !$struct->content_id)) { + $part_headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $struct->mime_id); + $struct->headers = $this->_parse_headers($part_headers) + $struct->headers; + } - // fetch message headers if message/rfc822 - if ($struct->ctype_primary=='message') - { - $headers = iil_C_FetchPartBody($this->conn, $this->mailbox, $this->_msg_id, $struct->mime_id.'.HEADER'); - $struct->headers = $this->_parse_headers($headers); - + if ($struct->ctype_primary=='message') { if (is_array($part[8]) && empty($struct->parts)) $struct->parts[] = $this->_structure_part($part[8], ++$count, $struct->mime_id); - } + } // normalize filename property $this->_set_part_filename($struct); diff --git a/program/include/rcube_message.php b/program/include/rcube_message.php index 1e3bc7f7e..329c39049 100644 --- a/program/include/rcube_message.php +++ b/program/include/rcube_message.php @@ -356,6 +356,10 @@ class rcube_message $mail_part->content_id = preg_replace(array('/^</', '/>$/'), '', $mail_part->headers['content-id']); $this->inline_parts[] = $mail_part; } + else if ($message_ctype_secondary == 'related' && $mail_part->headers['content-location']) { + $mail_part->content_location = $mail_part->headers['content-base'] . $mail_part->headers['content-location']; + $this->inline_parts[] = $mail_part; + } // is regular attachment else { if (!$mail_part->filename) @@ -370,7 +374,11 @@ class rcube_message $a_replaces = array(); foreach ($this->inline_parts as $inline_object) { - $a_replaces['cid:'.$inline_object->content_id] = $this->get_part_url($inline_object->mime_id); + $part_url = $this->get_part_url($inline_object->mime_id); + if ($inline_object->content_id) + $a_replaces['cid:'.$inline_object->content_id] = $part_url; + if ($inline_object->content_location) + $a_replaces[$inline_object->content_location] = $part_url; } // add replace array to each content part |