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,9 +531,20 @@ abstract class kolab_format
|
||||||
continue;
|
continue;
|
||||||
$attach = new Attachment;
|
$attach = new Attachment;
|
||||||
$attach->setLabel((string)$attr['name']);
|
$attach->setLabel((string)$attr['name']);
|
||||||
$attach->setUri('cid:' . $cid, $attr['mimetype']);
|
$attach->setUri('cid:' . $cid, $attr['mimetype'] ?: 'application/octet-stream');
|
||||||
|
if ($attach->isValid()) {
|
||||||
$vattach->push($attach);
|
$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) {
|
foreach ((array) $object['links'] as $link) {
|
||||||
$attach = new Attachment;
|
$attach = new Attachment;
|
||||||
|
|
Loading…
Add table
Reference in a new issue