multiple fixes around managed attachments and new Horde_Icalendar:

- no longer decodes base64 automatic
- size param have to be string due to bug in handling of integers in Horde_Icalendar
- allow stripping of non-binary (eg. text/plain) inline attachments
- only add X-EGROUPWARE-ATTACH-INCLUDED, if we have a real managed attachment
- store external / url attachments as other unsupported attributes
This commit is contained in:
Ralf Becker 2015-09-29 07:37:15 +00:00
parent 17b9b5912e
commit b34cbded3a
2 changed files with 10 additions and 6 deletions

View File

@ -2978,6 +2978,9 @@ class calendar_ical extends calendar_boupdate
case 'X-LIC-ERROR': // parse errors from libical, makes no sense to store them
break;
case 'ATTACH':
if ($attributes['params'] && !empty($attributes['params']['FMTTYPE'])) break; // handeled by managed attachment code
// fall throught to store external attachment url
default: // X- attribute or other by EGroupware unsupported property
//error_log(__METHOD__."() $attributes[name] = ".array2string($attributes));
// for attributes with multiple values in multiple lines, merge the values

View File

@ -1382,10 +1382,11 @@ class groupdav extends HTTP_WebDAV_Server
// turn inline attachments into managed ones
foreach($attach as $key => $attr)
{
if ($attr['params']['VALUE'] === 'BINARY')
if (!empty($attr['params']['FMTTYPE']))
{
if (!($to = self::fopen_attachment($app, $id, $filename=$attr['params']['FILENAME'], $attr['params']['FMTTYPE'], $path)) ||
($copied=fwrite($to, $attr['value'])) === false)
// Horde Icalendar does NOT decode automatic
($copied=fwrite($to, $attr['params']['ENCODING'] == 'BASE64' ? base64_decode($attr['value']) : $attr['value'])) === false)
{
error_log(__METHOD__."('$app', $id, ...) failed to add attachment ".array2string($attr).") ");
continue;
@ -1484,13 +1485,13 @@ class groupdav extends HTTP_WebDAV_Server
$parameters['ATTACH'][] = array(
'MANAGED-ID' => groupdav::path2managed_id($path),
'FMTTYPE' => $stat['mime'],
'SIZE' => $stat['size'],
'SIZE' => (string)$stat['size'], // Horde_Icalendar renders int as empty string
'FILENAME' => egw_vfs::basename($path),
);
// if we have attachments, set X-attribute to enable deleting them by put
// (works around events synced before without ATTACH attributes)
$attributes['X-EGROUPWARE-ATTACH-INCLUDED'] = 'TRUE';
}
// if we have attachments, set X-attribute to enable deleting them by put
// (works around events synced before without ATTACH attributes)
if ($attributes['ATTACH']) $attributes['X-EGROUPWARE-ATTACH-INCLUDED'] = 'TRUE';
}
/**