Skip to content

Commit

Permalink
Pass detected Content-Type to iTip handler.
Browse files Browse the repository at this point in the history
When displaying the attachment summary, we try to detect the real MIME type if it has been specified as octet-stream. This works fine and the correct MIME viewer is loaded.
But this detected content type hasn't been passed further on to the iTip Ajax handler, so it tried to import those components with the original octet-stream content type while the applications' APIs expected actually supported type.
  • Loading branch information
yunosh committed Nov 23, 2016
1 parent 7a99f25 commit f9a59b2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions imp/lib/Ajax/Imple/ItipRequest.php
Expand Up @@ -41,8 +41,9 @@ public function __construct(array $params = array())
protected function _attach($init)
{
return array(
'ctype' => $this->_params['ctype'],
'mime_id' => $this->_params['mime_id'],
'muid' => $this->_params['muid']
'muid' => $this->_params['muid'],
);
}

Expand All @@ -69,7 +70,12 @@ protected function _handle(Horde_Variables $vars)
$mime_part = $contents->getMIMEPart($vars->mime_id);
if (empty($mime_part)) {
throw new IMP_Exception(_("Cannot retrieve calendar data from message."));
} elseif (!$vCal->parsevCalendar($mime_part->getContents(), 'VCALENDAR', $mime_part->getCharset())) {
}
if ($vars->ctype) {
$mime_part = clone $mime_part;
$mime_part->setType($vars->ctype);
}
if (!$vCal->parsevCalendar($mime_part->getContents(), 'VCALENDAR', $mime_part->getCharset())) {
throw new IMP_Exception(_("The calendar data is invalid"));
}

Expand Down
1 change: 1 addition & 0 deletions imp/lib/Factory/MimeViewer.php
Expand Up @@ -114,6 +114,7 @@ public function getViewerConfig($type, $app)
}

$params['imp_contents'] = $this->_contents;
$params['type'] = $type;

return array($driver, $params);
}
Expand Down
3 changes: 2 additions & 1 deletion imp/lib/Mime/Viewer/Itip.php
Expand Up @@ -106,8 +106,9 @@ protected function _renderInline()
}

$imple = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_ItipRequest', array(
'ctype' => $this->_conf['type'],
'mime_id' => $mime_id,
'muid' => strval($imp_contents->getIndicesOb())
'muid' => strval($imp_contents->getIndicesOb()),
));

// Get the method type.
Expand Down

0 comments on commit f9a59b2

Please sign in to comment.