GNOME Bugzilla – Bug 669220
Evolution cannot delete or modify calendar events due to sending escape characters to caldav server
Last modified: 2012-02-21 08:41:47 UTC
Deleting calendar events from a caldav server fails with a '412 precondition failed error' as evolution-data-server sends escape characters in the If-Match header like so... LOG: headers:-->If-Match: \\"5271cef89123fcca4bbe701e872b0a42\\" instead of the more correct... LOG: headers:-->If-Match: "5271cef89123fcca4bbe701e872b0a42" This could be due to some caldav servers sending the etag as quoted and EDS attempting to escape the quotes. This is evident using the davical caldav server, but could happen in other servers also.
In addition to not being able to delete calendar events, they also cannot be modified. LOG: response:--> <if-match/>Existing resource ETag of ""5271cef89123fcca4bbe701e872b0a42"" does not match "\\"5271cef89123fcca4bbe701e872b0a42\\""
I concur. Logs from the calendar server (when doing, for example, a task list record update) indicate this quite beyond any doubt: Request from Evolution: "PUT /caldav.php/gregab/home/20111212T050017Z-2284-1000-1964-0_pooh.p0f.net-20111212T050039Z.ics HTTP/1.1" Error log from DAViCal: :***************** Response Header **************** headers:-->X-Powered-By: PHP/5.2.10 headers:-->Server: 1.0 headers:-->DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule headers:-->DAV: extended-mkcol, calendar-proxy, bind, addressbook, calendar-auto-schedule headers:-->X-DAViCal-Version: DAViCal/1.0.2; DB/1.2.11 headers:-->Content-type: text/xml; charset="utf-8" :******************** Response ******************** response:--><?xml version="1.0" encoding="utf-8" ?> response:--><error xmlns="DAV:"> response:--> <if-match/>Existing resource ETag of ""69a42f22915bc998b2987aebb56e37e0"" does not match "\\"69a42f22915bc998b2987aebb56e37e0\\"" response:--></error> Evolution 3.2.3.
Another proof it's Evolution's bug: this patch fixes things in DAViCal: diff -Naur calendar-1.0.2/inc/caldav-DELETE.php calendar/inc/caldav-DELETE.php --- calendar-1.0.2/inc/caldav-DELETE.php 2011-10-31 21:03:58.000000000 +0100 +++ calendar/inc/caldav-DELETE.php 2012-02-11 07:40:51.000000000 +0100 @@ -49,6 +49,13 @@ $qry = new AwlQuery(); $qry->Begin(); + /* XXX Temporary fix for an Evolution bug. XXX */ + if (isset($request->etag_if_match)) { + $request->etag_if_match = preg_replace('\\', '', $request->etag_if_match); + } elseif (isset($request->etag_none_match)) { + $request->etag_none_match = preg_replace('\\', '', $request->etag_none_match); + } + if ( $dav_resource->IsCollection() ) { if ( $dav_resource->IsBinding() ) { $params = array( ':dav_name' => $dav_resource->dav_name() ); diff -Naur calendar-1.0.2/inc/caldav-MOVE.php calendar/inc/caldav-MOVE.php --- calendar-1.0.2/inc/caldav-MOVE.php 2011-11-22 11:45:19.000000000 +0100 +++ calendar/inc/caldav-MOVE.php 2012-02-11 07:37:05.000000000 +0100 @@ -59,6 +59,12 @@ else { if ( (isset($request->etag_if_match) && $request->etag_if_match != '' ) || ( isset($request->etag_none_match) && $request->etag_none_match != '') ) { + /* XXX Temporary fix for an Evolution bug. XXX */ + if (isset($request->etag_if_match)) { + $request->etag_if_match = preg_replace('\\', '', $request->etag_if_match); + } elseif (isset($request->etag_none_match)) { + $request->etag_none_match = preg_replace('\\', '', $request->etag_none_match); + } /** * RFC2068, 14.25: diff -Naur calendar-1.0.2/inc/caldav-PUT-default.php calendar/inc/caldav-PUT-default.php --- calendar-1.0.2/inc/caldav-PUT-default.php 2011-12-02 01:09:48.000000000 +0100 +++ calendar/inc/caldav-PUT-default.php 2012-02-11 07:39:10.000000000 +0100 @@ -52,6 +52,13 @@ $dest->NeedPrivilege('DAV::write-content'); } + /* XXX Temporary fix for an Evolution bug. XXX */ + if (isset($request->etag_if_match)) { + $request->etag_if_match = preg_replace('\\', '', $request->etag_if_match); + } elseif (isset($request->etag_none_match)) { + $request->etag_none_match = preg_replace('\\', '', $request->etag_none_match); + } + if ( isset($request->etag_none_match) && $request->etag_none_match != '*' && $dest->Exists() ) { $request->DoResponse(412); } diff -Naur calendar-1.0.2/inc/caldav-PUT-vcalendar.php calendar/inc/caldav-PUT-vcalendar.php --- calendar-1.0.2/inc/caldav-PUT-vcalendar.php 2011-11-29 11:30:41.000000000 +0100 +++ calendar/inc/caldav-PUT-vcalendar.php 2012-02-11 07:38:40.000000000 +0100 @@ -54,6 +54,13 @@ $etag = md5($request->raw_post); + /* XXX Temporary fix for an Evolution bug. XXX */ + if (isset($request->etag_if_match)) { + $request->etag_if_match = preg_replace('\\', '', $request->etag_if_match); + } elseif (isset($request->etag_none_match)) { + $request->etag_none_match = preg_replace('\\', '', $request->etag_none_match); + } + if ( ! $dav_resource->Exists() && (isset($request->etag_if_match) && $request->etag_if_match != '') ) { /** * RFC2068, 14.25: diff -Naur calendar-1.0.2/inc/caldav-PUT-vcard.php calendar/inc/caldav-PUT-vcard.php --- calendar-1.0.2/inc/caldav-PUT-vcard.php 2012-01-13 04:17:42.000000000 +0100 +++ calendar/inc/caldav-PUT-vcard.php 2012-02-11 07:38:34.000000000 +0100 @@ -44,6 +44,13 @@ $dest->NeedPrivilege('DAV::write-content'); } + /* XXX Temporary fix for an Evolution bug. XXX */ + if (isset($request->etag_if_match)) { + $request->etag_if_match = preg_replace('\\', '', $request->etag_if_match); + } elseif (isset($request->etag_none_match)) { + $request->etag_none_match = preg_replace('\\', '', $request->etag_none_match); + } + if ( isset($request->etag_none_match) && $request->etag_none_match != '*' && $dest->Exists() ) { $request->PreconditionFailed(412,'if-none-match', translate('A resource already exists at the destination.')); }
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 669003 ***