Avoid saving attachments with empty mimetype; validate before adding to XML (#2927)
This commit is contained in:
parent
621582307f
commit
2dec4c3e6e
1 changed files with 13 additions and 2 deletions
|
@ -531,8 +531,19 @@ abstract class kolab_format
|
|||
continue;
|
||||
$attach = new Attachment;
|
||||
$attach->setLabel((string)$attr['name']);
|
||||
$attach->setUri('cid:' . $cid, $attr['mimetype']);
|
||||
$vattach->push($attach);
|
||||
$attach->setUri('cid:' . $cid, $attr['mimetype'] ?: 'application/octet-stream');
|
||||
if ($attach->isValid()) {
|
||||
$vattach->push($attach);
|
||||
}
|
||||
else {
|
||||
rcube::raise_error(array(
|
||||
'code' => 660,
|
||||
'type' => 'php',
|
||||
'file' => __FILE__,
|
||||
'line' => __LINE__,
|
||||
'message' => "Invalid attributes for attachment $cid: " . var_export($attr, true),
|
||||
), true);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ((array) $object['links'] as $link) {
|
||||
|
|
Loading…
Add table
Reference in a new issue