* CalDAV: work around Lighning not having synced event before accepting

This commit is contained in:
Ralf Becker 2019-02-21 17:00:00 +01:00
parent 7e79088191
commit 8670036af6
3 changed files with 19 additions and 3 deletions

View File

@ -586,10 +586,12 @@ abstract class Handler
// send Location header only on success AND if we dont use caldav_name as path-attribute or // send Location header only on success AND if we dont use caldav_name as path-attribute or
if ((is_bool($retval) ? $retval : $retval[0] === '2') && (!$path_attr_is_name || if ((is_bool($retval) ? $retval : $retval[0] === '2') && (!$path_attr_is_name ||
// POST with add-member query parameter // POST with add-member query parameter
$_SERVER['REQUEST_METHOD'] == 'POST' && isset($_GET['add-member']))) $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_GET['add-member'])) ||
// in case we choose to use a different name for the resourece, give the client a hint
basename($path) !== $this->new_id)
{ {
$path = preg_replace('|(.*)/[^/]*|', '\1/', $path); $path = preg_replace('|(.*)/[^/]*|', '\1/', $path);
header('Location: '.$this->base_uri.$path.$this->get_path($entry)); header('Location: '.$this->base_uri.$path.$this->new_id);
} }
} }

View File

@ -835,6 +835,16 @@ class calendar_groupdav extends Api\CalDAV\Handler
if (!$prefix) $user = null; // /infolog/ does not imply setting the current user (for new entries it's done anyway) if (!$prefix) $user = null; // /infolog/ does not imply setting the current user (for new entries it's done anyway)
// work around missing handling / racecondition in Lightning, if event already exists on server,
// but Lightning has not yet synced with the server: Lightning just retries the PUT, not GETing the event
// --> for now we ignore the If-None-Match: "*" as the lesser of two evils ;)
if (self::get_agent() === 'lightning' && isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
in_array($_SERVER['HTTP_IF_NONE_MATCH'], array('*', '"*"')))
{
unset($_SERVER['HTTP_IF_NONE_MATCH']);
$workaround_lightning_if_none_match = true;
}
// fix for iCal4OL using WinHTTP only supporting a certain header length // fix for iCal4OL using WinHTTP only supporting a certain header length
if (isset($_SERVER['HTTP_IF_SCHEDULE']) && !isset($_SERVER['HTTP_IF_SCHEDULE_TAG_MATCH'])) if (isset($_SERVER['HTTP_IF_SCHEDULE']) && !isset($_SERVER['HTTP_IF_SCHEDULE_TAG_MATCH']))
{ {
@ -920,7 +930,9 @@ class calendar_groupdav extends Api\CalDAV\Handler
// Work around problems with Outlook CalDAV Synchroniser (https://caldavsynchronizer.org/) // Work around problems with Outlook CalDAV Synchroniser (https://caldavsynchronizer.org/)
// - always sends all participants back with status NEEDS-ACTION --> resets status of all participant, if user has edit rights // - always sends all participants back with status NEEDS-ACTION --> resets status of all participant, if user has edit rights
// --> allow full updates only for organizer // --> allow full updates only for organizer
self::get_agent() == 'caldavsynchronizer' && $oldEvent['owner'] != $user) self::get_agent() == 'caldavsynchronizer' && $oldEvent['owner'] != $user ||
// we ignored Lightings If-None-Match: "*" --> do not overwrite event, just change status
!empty($workaround_lightning_if_none_match))
{ {
$user_and_memberships = $GLOBALS['egw']->accounts->memberships($user, true); $user_and_memberships = $GLOBALS['egw']->accounts->memberships($user, true);
$user_and_memberships[] = $user; $user_and_memberships[] = $user;

View File

@ -2758,6 +2758,8 @@ class calendar_ical extends calendar_boupdate
{ {
$email = $attributes['value']; $email = $attributes['value'];
} }
// work around Ligthning sending @ as %40
$email = str_replace('%40', '@', $email);
// try X-EGROUPWARE-UID, but only if it resolves to same email (otherwise we are in trouble if different EGw installs talk to each other) // try X-EGROUPWARE-UID, but only if it resolves to same email (otherwise we are in trouble if different EGw installs talk to each other)
if (!$uid && !empty($attributes['params']['X-EGROUPWARE-UID']) && if (!$uid && !empty($attributes['params']['X-EGROUPWARE-UID']) &&
($res_info = $this->resource_info($attributes['params']['X-EGROUPWARE-UID'])) && ($res_info = $this->resource_info($attributes['params']['X-EGROUPWARE-UID'])) &&