Fixed setting mimetype of attachments on create/update event (#244)
This commit is contained in:
parent
7e3a88996f
commit
159d672a1d
1 changed files with 8 additions and 3 deletions
|
@ -289,6 +289,7 @@ class kolab_calendar
|
||||||
$old = $this->storage->getObject($event['id']);
|
$old = $this->storage->getObject($event['id']);
|
||||||
$object = array_merge($old, $this->_from_rcube_event($event));
|
$object = array_merge($old, $this->_from_rcube_event($event));
|
||||||
$saved = $this->storage->save($object, $event['id']);
|
$saved = $this->storage->save($object, $event['id']);
|
||||||
|
|
||||||
if (PEAR::isError($saved)) {
|
if (PEAR::isError($saved)) {
|
||||||
raise_error(array(
|
raise_error(array(
|
||||||
'code' => 600, 'type' => 'php',
|
'code' => 600, 'type' => 'php',
|
||||||
|
@ -702,7 +703,7 @@ class kolab_calendar
|
||||||
// Roundcube ID has nothing to do with Horde ID, remove it
|
// Roundcube ID has nothing to do with Horde ID, remove it
|
||||||
if ($attachment['content'])
|
if ($attachment['content'])
|
||||||
unset($attachment['id']);
|
unset($attachment['id']);
|
||||||
|
|
||||||
// Horde code assumes that there will be no more than
|
// Horde code assumes that there will be no more than
|
||||||
// one file with the same name: make filenames unique
|
// one file with the same name: make filenames unique
|
||||||
$filename = $attachment['name'];
|
$filename = $attachment['name'];
|
||||||
|
@ -710,12 +711,16 @@ class kolab_calendar
|
||||||
$ext = preg_match('/(\.[a-z0-9]{1,6})$/i', $filename, $m) ? $m[1] : null;
|
$ext = preg_match('/(\.[a-z0-9]{1,6})$/i', $filename, $m) ? $m[1] : null;
|
||||||
$attachment['name'] = basename($filename, $ext) . '-' . $collisions[$filename] . $ext;
|
$attachment['name'] = basename($filename, $ext) . '-' . $collisions[$filename] . $ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set type parameter
|
||||||
|
if ($attachment['mimetype'])
|
||||||
|
$attachment['type'] = $attachment['mimetype'];
|
||||||
|
|
||||||
$object['_attachments'][$attachment['name']] = $attachment;
|
$object['_attachments'][$attachment['name']] = $attachment;
|
||||||
unset($event['attachments'][$idx]);
|
unset($event['attachments'][$idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// process event attendees
|
// process event attendees
|
||||||
foreach ((array)$event['attendees'] as $attendee) {
|
foreach ((array)$event['attendees'] as $attendee) {
|
||||||
$role = $attendee['role'];
|
$role = $attendee['role'];
|
||||||
|
|
Loading…
Add table
Reference in a new issue